I have json like below, how can i loop each id
{
"id1": {
"AreaN": "\u30ef\u30fc\u30eb\u30c9\u30d0\u30b6\u30fc\u30eb",
"AreaM": "\uff9c\uff70\uff99\uff84\uff9e\uff8a\uff9e\uff7b\uff9e\uff70\uff99"
},
"id2": {
"AreaN": "\u30ef\u30fc\u30eb\u30c9\u30d0\u30b6\u30fc\u30eb",
"AreaM": "\uff9c\uff70\uff99\uff84\uff9e\uff8a\uff9e\uff7b\uff9e\uff70\uff99"
}
}
I tried but it does not get all the ids, i cant change the json.
$json = json_decode($doc);
if( count($json) > 0 )
{
foreach($json as $area)
{
}
}
In my case the ids i want to get are not inside an array. Is it possible to loop the ids and keep them as objects, i prefer object access than using square brackets.