PHP json_encode() Function is used to encode array value to JSON format. A json_encode() function is built-in function in PHP.
Syntax :
json_encode(array $array);
Parameter,
$array: Required. It is a input array.
Return Values :
It returns a JSON object or json array for associative array and numeric array respectively.
Objects in PHP can be converted into JSON by using the PHP function json_encode().
Let's see below example to understand php json_encode() Function in details.
Comments