everybody! Could I ask you to help me to decode this JSON code:
$json = \'{\"inbox\":[{\"from\":\"55512351\",\"date\":\"29\\/03\\/2010\",\"time\":\"21:24:10\
Looks like the recipients property is an array, try this:
$json = '{"inbox":[{"from":"55512351","date":"29\/03\/2010","time":"21:24:10","utcOffsetSeconds":3600,"recipients":[{"address":"55512351","name":"55512351","deliveryStatus":"notRequested"}],"body":"This is message text."},{"from":"55512351","date":"29\/03\/2010","time":"21:24:12","utcOffsetSeconds":3600,"recipients":[{"address":"55512351","name":"55512351","deliveryStatus":"notRequested"}],"body":"This is message text."},{"from":"55512351","date":"29\/03\/2010","time":"21:24:13","utcOffsetSeconds":3600,"recipients":[{"address":"55512351","name":"55512351","deliveryStatus":"notRequested"}],"body":"This is message text."},{"from":"55512351","date":"29\/03\/2010","time":"21:24:13","utcOffsetSeconds":3600,"recipients":[{"address":"55512351","name":"55512351","deliveryStatus":"notRequested"}],"body":"This is message text."}]}';
$data = json_decode($json);
print_r($data);
foreach ($data->inbox as $note)
{
echo '';
echo 'From : ' . htmlspecialchars($note->from) . '
';
echo 'Date : ' . htmlspecialchars($note->date) . '
';
echo 'Time : ' . htmlspecialchars($note->time) . '
';
echo 'Body : ' . htmlspecialchars($note->body) . '
';
foreach($note->recipients as $recipient)
{
echo 'To (address) : ' . htmlspecialchars($recipient->address) . '
';
echo 'To (name) : ' . htmlspecialchars($recipient->name) . '
';
echo 'Status : ' . htmlspecialchars($recipient->deliveryStatus) . '
';
}
}