My question is entirely related to the structure of JSON. I've this:
{
"cars": {
"rows": [
{
"name": "Mercedes",
"color": "Black",
"make": "Mercedes"
},
{
"name": "BMW",
"color": "Black",
"make": "BMW Germany"
},
{
"name": "Innova",
"color": "Red",
"make": "Toyota"
}
]
}
}
Till now, row is an array of objects that contains information of different cars. I want two such row arrays. Only two are required. Like this:
{
"staticKpi": {
"rows": [
{
// 1st row 1st object
},
{
// 1st row 2nd object
},
{
// 1st row 3rd object
}
],
[
{
// 2nd row 1st object
},
{
// 2nd row 2nd object
},
{
// 2nd row 3rd object
}
]
}
}
You can see this JSON here.
But this is giving me JSON error. I just want to keep two lines of objects so there will be only two arrays in rows. hope I was able to explain the problem. Please correct my mistake.
PS: I've run forEach loop later on this JSON. So I've to take care of that too.
rowsbeing an array? This structure is invalid :{ "rows": [ { } ],[ { } ] }. However, this one is valid{ "rows": [ [ { } ], [ { } ] ] }