How this json decode example works
Pass true as the second argument to get an associative array; without it you get an object and use ->. Invalid JSON returns null, so check errors as shown on the json_decode() reference page.
Convert a JSON string to a PHP array or object with json_decode(). Edit the code below and press Run to execute it with real PHP in your browser.
Name: John Age: 30 City: New York
Pass true as the second argument to get an associative array; without it you get an object and use ->. Invalid JSON returns null, so check errors as shown on the json_decode() reference page.