Return to Snippet

Revision: 18203
at September 23, 2009 15:56 by paulgrenwood


Initial Code
$json_string='{"id":1,"name":"foo","email":"[email protected]","interest":["wordpress","php"]} ';
$obj=json_decode($json_string);
echo $obj->name; //prints foo
echo $obj->interest[1]; //prints php

Initial URL

                                

Initial Description
With most of the popular web services like Twitter providing their data through APIs, it is always helpful to know how to parse API data which is sent in various formats including JSON, XML etc.

Initial Title
Parse JSON Data

Initial Tags
php, json

Initial Language
PHP