I'm trying to read the value of a json nested object.
I have tried in these ways but without success.
data
{ "foo": 1,
"bar": 10,
"rows": [ {"id":1,"name":"Luke" },
{"id":2,"name":"Sky" },
{"id":3,"name":"Walker"} ]
}
Ajax
$.ajax({
data: params,
dataType: 'json',
success: function(data) {
console.log(data.rows) // data of rows object - OK !
console.log(data["rows"].id); // undefined
console.log(data.rows.id); // undefined
}
});
How could I do? Thank you