Thursday , November 7 2024

Parse JSON Data Using PHP

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. 

$json_string='{“id”:1,”name”:”foo”,”email”:”test@testmail.com”,”interest”:[“wordpress”,”php”]} ‘;
$obj=json_decode($json_string);
echo $obj->name; //prints foo
echo $obj->interest[1]; //prints php

About admin

Check Also

Resize Images in php

Creating thumbnails of the images is required many a times, this code will be useful …

Leave a Reply