Forum Moderators: coopster

Message Too Old, No Replies

Howto Decode JSON data in PHP

         

HoboTraveler

4:17 pm on Apr 29, 2008 (gmt 0)

10+ Year Member



Hi All,

I am curious to know how to get PHP to decode the following JSON reply from the server.

Is there a Json function in PHP that decodes this?

blah({"totalResultsCount":1,"foo":[{"test":"age","name":"bob","fcl":"S","fclName":"spot, building, farm","name":"foobar ","countryCode":"BR","lng":-48.225594,"fcode":"AIRP","geonameId":6300682,"lat":-18.882844,"adminName1":"","population":0}]});

TIA

coopster

4:53 pm on Apr 29, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Did you review the JSON Functions [php.net]?

cameraman

4:56 pm on Apr 29, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I had to remove blah() to get it to work.

HoboTraveler

5:56 pm on Apr 29, 2008 (gmt 0)

10+ Year Member



How did you get it to work?

cameraman

6:14 pm on Apr 29, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I just removed blah( from the beginning of your string and its matching ) from the end, and submitted it to json_decode()