View nested JSON objects


I'm brand new to javascript and json and can't find any examples that explain how to get nested json objects.

This works great:

var someJson={"name":"spuder"};
//alert shows spuder

This returns undefined:

//This is the json from the stream I am reading
var someJson={"name":"spuder","car":[{"model":"ford","year":"2000"}] };

how do you return spuders car model or car year?

alert(; //doesn't work..

You have created your car as an array. To get the model of the first car in the array: