I have the following script to get search results from an API and then slice the array and dump it, I am having trouble decoding the JSON into an array, it returns Arr
If input is in array format then also you can use the same function json_decode. You just need to apply loop for result.
json = '{
"a1":{ "field1":"name1", "field2":age1, "field3":"country1" },
"a2":{ "field1":"name2", "field2":age2, "field3":"country2" },
"a3":{ "field1":"name3", "field2":age3, "field3":"country3" } }';
$Array = json_decode($json, true);
foreach ($Array as $key => $value)
{echo " $key "; foreach ($value as $k => $val) { echo "$k | $val
"; }}