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","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."}]}';
I would like to organize above structure to this:
Note 1:
Folder: inbox
From (from): …
Date (date): …
Time (time): …
utcOffsetSeconds: …
Recepient (address): …
Recepient (name): …
Status (deliveryStatus): …
Text (body): …
Note 2:
…
Thank you in advance!
You can use the
json_decodefunction, to decode your JSON string :And you’ll get something like this :
Now that you know the structure of the data, you can iterate over it ; for instance, you could use something like this :
And you’ll get this kind of output :