How to read complex data in array/JSON with PHP? -
i've been facing hard times read bunch of data in json using json_decode() function in php. need read basic data display flights dates origins , destinations.
this how should be:
20 solutions found. solution# 1 sale price: brl2919.54 slice 0 ta 916 gru 2015-06-16t06:15-03:00 lim 2015-06-16t09:20-05:00 av 962 lim 2015-06-16t10:04-05:00 mia 2015-06-16t16:48-04:00
and json code: http://pastebin.com/dh16rrit
when try transform , read comes null data.
$data = json_decode($results, true); // $results variable json content url above echo $data['tripoption']['saletotal']; // example
yes , should use
print_r($a['trips']['tripoption'][0]['saletotal'])
if want read data inside array,you can follows:
$data = json_decode($s,true); foreach ($data['trips']['tripoption'] $item){ print_r($item['saletotal'] . "\n"); };
Comments
Post a Comment