I'm very confused in Javascript for getting JSON value using the defined variables.
Here is JSON data below:
AllData = {data0 : {name: "John", age: 31, city: "New York"}},
{data1 : {name: "Marin", age: 20, city: "New York"}},
{data2 : {name: "Marin", age: 20, city: "New York"}}
Of course I can get the value using "AllData.data0", however, I want to get all the data in for loop.
for (i=0;i<AllData.length;i++) {
num = i.toString()
data = "data" +i
AllData.data
}
But it always return "undefined", intial language that I've been using is Python so that I'm very confused in javascrtip, could you help on this matter?
Thanks in advance.