What is JSON?
How to decode JSON data in PHP?
To decode JSON string in PHP, you can use the json_decode() function to convert the JSON string to the appropriate PHP data type. The example below shows how to parse or decode a JSON string to a PHP object:
How to encode a PHP object to JSON string?
To encode PHP objects into JSON strings, you can use the json_encode() function. A PHP object can be of any PHP data type, except for a resource such as a database or a file descriptor. The example below shows how to encode a PHP associative array into a JSON string: