I have this json file (data.json):
{
"country":[{
"Russia":[
"Voronezh",
"Moscow",
"Vorkuta"
],
"United Kingdom":[
"London"
]
}],
"countryCodes":[
"ru",
"uk"
]
}
and such code:
$.getJSON('data.json', function success(data){
alert(data.country[0]);
});
this returned "undefined". But i want get "Russia", and having indexes object Russia, i want get "Voronezh", don't use "data.country.Russia".
Sorry for my English.
console.log(data)in the success callback to see the object you're getting.