I am working with HTTP API for sending SMS. I am trying to decode this json file which i actually receive after i made a post URL. Now i want to know is how can i decode the thing.. if this is static then i can decode but the fact is it have number key which may increase to any extension. In that case what i will do and how will i decode that post and also i need to save in mysql. Please anyone help me out of this problem.
{"msg_id":"4396-7666-1337896-1dc5c765ad7-5537bb07-123638242","SenderId":"EXECUT","linecount":"1","billcredit":"0.00","message":"Hello+Test+Message","sendondate":"2015-04-22 20:45:00","seq_id":{"**1**":{"valid":"true","billcredit":"1.00","id_provider":"24","providerkey":"HUTCH","regionKey":"WB","originalnumber":"1234567890","validnumber":"1234567890","mnpID":"106","dlr_seq":1},"**2**":{"valid":"true","billcredit":"1.00","id_provider":"24","providerkey":"HUTCH","regionKey":"WB","originalnumber":"1234567890","validnumber":"1234567890","mnpID":"106","dlr_seq":2}}}
I actually did the following
$json = file_get_contents($daat);
$obj = json_decode($json);
$num= $obj->seq_id->{'1'}->validnumber;
But this will be valid only if i am having static json what to do incase of dynamic one.