To convert a JSON data string to a PHP array, you can use the json_decode() function. The json_decode() function accepts the JSON string as the first parameter and a few additional parameters to control the process of converting JSON to PHP array. If the JSON cannot be converted or the data nesting depth exceeds the recursion limit, the converting function will return NULL. In this JSON convert to a PHP array example, we use the json_decode() function to convert JSON string to a PHP array. Click Execute to run the JSON to PHP Array Example online and see the result.
How to decode JSON string into PHP object?
You can use the json_decode() function to convert JSON strings into PHP objects. The result object can be any PHP data type, including an array, except for resource pointers such as a database or file descriptor.