I have json data and i want to select some data plese read the json
"response":{"status":1,"httpStatus":200,"data":{"page":1,"current":0,"count":982,"pageCount":1,
"data":{"1131":{"OfferFile":
{"offer_id":"547"}},
"1525":{"OfferFile":{"offer_id":"717"}}
}
From above data i want to select 1131 and 1525 integers via php
Please give me a code snd thanks.
I am assuming that the actual JSON that you have, when formatted properly, looks as follows:
{
"status":1,
"httpStatus":200,
"page":1,
"current":0,
"count":982,
"pageCount":1,
"data":{
"1131":{
"OfferFile":{
"offer_id":"547"
}
},
"1525":{
"OfferFile":{
"offer_id":"717"
}
}
}
}
If so, you would get the integers with the following code:
$json = json_decode($string, true);
$ids = array_keys($json['data']);