question about php decode JSON
- by cj333
Hi, I still have some question about php decode JSON.
the JSON return like this.
all({"Total":30,"Debug":null,"Documents":[
{
"DocTitle":"Image: A municipal police officer takes positio",
"Docmultimedia":[
{
"DocExpire":"2/7/2011 1:39:02 PM"
}
]
}
...]
});
this is my php code:
foreach ($data->Documents as $result) {
echo htmlspecialchars($result->DocTitle).'<br />';
if(!empty($result->Docmultimedia)){
echo htmlspecialchars($result->Docmultimedia->DocExpire).'<br />';
}
}
It return Warning: Invalid argument supplied for foreach().
and echo htmlspecialchars($result->Docmultimedia->DocExpire), is it write right? Thanks all.