Link to home
Start Free TrialLog in
Avatar of jfsedlar3rd
jfsedlar3rdFlag for United States of America

asked on

Parsing json file with php

I need some help parsing this json file using php. I am a .NET programmer and i am a novice with php.

I was able to access some of the contents using:

$json = file_get_contents('')
$obj = json_decode($json,true);
$type = $obj->{'predominantType'};

The content i am having trouble with is the "dayList" array.

how can i access each day in a loop and set the data to a variable?
{"city":"Flint","dayList":[{"dateTime":1284681600000,"desc":"The amount of pollen in the air for Friday will be higher than they were on Thursday in the moderate range. This increase is due to drier air. If you do suffer from allergies Friday could be more difficult.","level":5.1},{"dateTime":1284768000000,"desc":"The amount of pollen in the air for Saturday will not change appreciably and will remain in the moderate range. This is a result of stable temperatures. This lack of change in airborne pollen will continue to affect those who suffer from allergies and those who live with the allergy sufferers.","level":5},{"dateTime":1284854400000,"desc":null,"level":2.8},{"dateTime":1284940800000,"desc":null,"level":3.2},{"dateTime":1285027200000,"desc":null,"level":4.3}],"predominantType":"Ragweed, Chenopods and Nettle.","state":"MI"}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of jfsedlar3rd
jfsedlar3rd
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial