What is JSON?
How to encode a PHP array into a JSON string?
There are two types of arrays in PHP: regular and associative (an associative array uses a key-value structure to store data). The json_encode() function can convert both array types to a JSON data string. We convert an associative array to a JSON string in the example below.
How to convert a multidimensional associative PHP array to JSON?
The example shows how to convert a multidimensional associative array to JSON using the json_encode() function: