views:

388

answers:

3

Hi , I would like parse data from google maps geocode version 3 through json. I would like to get details like locaityName, AdministrativeAreaName and status code. May I know how to parse these data? Thank you

A: 

You can use the json_encode and json_decode functions to parse json data.

More info:

http://php.net/manual/en/function.json-encode.php

Sarfraz
I would like to parse specific data from google geocode as I mentioned above. do you know the structure of parsing these data? Thanks.
benmsia
A: 

PHP has json_decode() that will convert a JSON data stream into a PHP array or object.

Pekka
I would like to parse specific data from google geocode as I mentioned above. do you know the structure of parsing these data? Thanks.
benmsia
@ben why don't you just make a request and find out yourself using `print_r()`? It's the easiest way.
Pekka
@pekka, i will try it out. thanks!
benmsia
A: 

Using the PHP PECL json library

json_decode()

http://php.net/manual/en/function.json-encode.php

Just an advice, if the function doesn't return anything that means that there is a syntax error into the JSON, it will not raise any error or log.

Cesar