Json reading with PHP

0

Well, I'm having a question about reading Json with PHP.

Json is this:

{"message":"Oi Gente","report":[{"0":[{"port":"gsm-2.3","phonenumber":"00000000000","time":"1970-01-08 10:00:26","result":"fail"}]}]}, 

but I can not display your values.

Thank you in advance!

    
asked by anonymous 09.03.2017 / 20:49

1 answer

1

Do this:

$json = '{"message":"Oi Gente","report":[{"0":[{"port":"gsm-2.3","phonenumber":"00000000000","time":"1970-01-08 10:00:26","result":"fail"}]}]}';
$json_dec = json_decode($json, true);

Then if you want, for example, message :

echo $json_dec['message'];

DEMONSTRATION

If you want, for example, time in report :

echo $json_dec['report'][0][0][0]['time'];

DEMONSTRATION

    
09.03.2017 / 20:53