Pull data from Google Search API and decode JSON string using PHP
Wednesday, June 11th, 2008PHP has a built-in function that can decode a JSON string and turn into an object or an object tree and is called PHP-JSON. This is very helpful for when you need to integrate or mashup with other application such as the google APIs. Here is a quick simple example:
<?php
$json_str = ‘{ “name” : “chris”}’;
$obj = json_decode($json_str);
echo $obj->name;
echo “\n”;
The above will return:
chris
