1<?php
2 // JSON string
3 $someJSON = '[{"name":"Jonathan Suh","gender":"male"},{"name":"William Philbin","gender":"male"},{"name":"Allison McKinnery","gender":"female"}]';
4
5 // Convert JSON string to Array
6 $someArray = json_decode($someJSON, true);
7 print_r($someArray); // Dump all data of the Array
8 echo $someArray[0]["name"]; // Access Array data
9
10 // Convert JSON string to Object
11 $someObject = json_decode($someJSON);
12 print_r($someObject); // Dump all data of the Object
13 echo $someObject[0]->name; // Access Object data
14?>
15