如何引用 JSON (Javascript) 对象的元素。例如:警报(homes.Agents[1].name);
<script>
var homes = [
{
"Agents" : {
"name" : "Bob Barker",
"name" : "Mona Mayflower"
},
"Listings" : [
{
"h_id": "3",
"city": "Dallas",
"state": "TX",
"zip": "75201",
"price": "162500"
},
{
"h_id": "4",
"city": "Bevery Hills",
"state": "CA",
"zip": "90210",
"price": "319250"
},
{
"h_id": "5",
"city": "New York",
"state": "NY",
"zip": "00010",
"price": "962500"
}
]
}
];
</script>