<?php
$raw_json = <<< 'JSON'
{
"fruit": [{
"id": 364823,
"name": "Lemon",
"amount": [33],
"profile": "http://google.com",
"buyid": 5
}, {
"id": 367851,
"name": "Orange",
"amount": [69, 95, 166],
"profile": "http://google.com",
"buyid": 3
},{
"id": 35647,
"name": "Apple",
"amount": [77, 43],
"profile": "http://google.com",
"buyid": 31
} ]
}
JSON;
$json = json_decode($raw_json, true);
foreach($json['fruit'] as $fruit){
echo implode(' ',$fruit['amount'])."\n";
}
preferences:
116 ms | 402 KiB | 5 Q