Lets say this JSON is held inside a variable called response
:
{
"brands": {
"Honda": [
"Accord",
"Civic"
],
"Porsche": [
"Cayenne",
"Cayman"
]
}
}
I want to access the models inside each brand for example:
for ( var car_brands in response.brands ) {
console.log(car_brands); // would console Honda, Porsche etc.
}
So how can i say for each car_brands
get the models( the array inside each car_brand) i.e Accord civic in the same loop.
Maybe i should structure my JSON properly to make it easier to parse.