javascript - how to decode nested json in php -


i having json string like:

[ {     "message": "test+sms",     "sender": "test",     "billcredit": "0.00",     "messagestatus": "dnd",     "sendondate": "2015-04-22 15:22:00",     "provider": "aaaa" }, {     "message": "test+sms",     "sender": "test",     "billcredit": "0.00",     "messagestatus": "dnd",     "sendondate": "2015-04-22 15:22:00",     "provider": "aaa" }, {     "message": "test+sms",     "sender": "test",     "billcredit": "1.00",     "messagestatus": "delivrd",     "sendondate": "2015-04-22 15:22:00",     "provider": "aaaa" }, {     "message": "test+sms",     "sender": "test",     "billcredit": "1.00",     "messagestatus": "dnd rejected",     "sendondate": "2015-04-22 15:22:00",     "provider": "aaaa" } ] 

i try doing this:

$objs = json_decode($data,true); foreach ($objs $obj){ $repor= $obj['messagestatus']; echo $repor; 

but not working. please can me rid out of this. please me upload $repor sequentially in mysql.

working fine check  $data='[{"message":"test+sms","sender":"execut","billcredit":"0.00","messagestatus":"dnd","sendondate":"2015-04-22  15:22:00","provider":"aaaa"},{"message":"test+sms","sender":"execut","billcredit":"0.00","messagestatus":"dnd","sendondate":"2015-04-22  15:22:00","provider":"aaa"},{"message":"test+sms","sender":"execut","billcredit":"1.00","messagestatus":"delivrd","sendondate":"2015-04-22 15:22:00","provider":"aaaa"},{"message":"test+sms","sender":"execut","billcredit":"1.00","messagestatus":"dnd rejected","sendondate":"2015-04-22 15:22:00","provider":"aaaa"}]';  $objs = json_decode($data, true); foreach ($objs $obj){     $repor= $obj['messagestatus'];     echo $repor." "; }  have placed single quotation around json array. nothing more. 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -