How can I read a nested json with ajax?
I have a json formatted by php after a sql request as follow :
[
{
"owner_info":
{
"name":"John",
"address":"4",
"date":"10/01/2012"
}
},
{
"telephone":
[
{
"id":"1",
"place":"5",
"number":"+123456"
},
{
"id":"2",
"place":"5",
"number":"+789456"
},
{
"id":"3",
"place":"8",
"number":"+0011223"
},
]
}
]
Ajax do a classic
$.getJSON(script, function (result) {
$(result).each(function(i){
// do something with result
});
});
I tried :
result[i].owner_info.name -> error
result[i].telephone[0].id -> error
I have been searching on the internet but can't find any solution...
thank you