Source Code:
(back to article)
<?php $json = '{"name":"John", "age":30, "city":"New York"}'; // decode the JSON data into a PHP object $obj = json_decode($json); // access the object properties echo $obj->name . PHP_EOL; // John echo $obj->age . PHP_EOL; // 30 echo $obj->city; // New York
Result:
Report an issue