Consider the following array of JSON objects:
myList = [
{title:"Parent1",
children:[{childname:"Child11"},
{childname:"Child12"}],
cars:[{carname:"Car11"},
{carname:"Car12"}]
},
{title:"Parent2",
children:[{childname:"Child21"},
{childname:"Child22"}],
cars:[{carname:"Car21"},
{carname:"Car22"}]
}
];
How does one access the "Child21" in javascript? The following options didn't work:
var myString = myList[1].children[0].childname; //Does not work
var myString = myList[1]["children"][0].childname; //Does not work