PHP JSON data parsing code

  • 2020-03-31 20:49:26
  • OfStack

This code can be used to parse the data obtained by POST from the renren connection site.
 
$json_string='{"id":1,"name":"jb51","email":"admin@jb51.net","interest":["wordpress","php"]} '; 
$obj=json_decode($json_string); 
echo $obj->name; //prints foo 
echo $obj->interest[1]; //prints php 

Here is an excerpt from a previous post on this site. More tips are available.
(link: #)

Related articles: