← All built-ins / json_encode_pretty()
json_encode_pretty()
json_encode_pretty(string $s): string
Parameters
| Name | Type | Description |
|---|---|---|
| $v | mixed | value to encode |
Return value
json_encode() with JSON_PRETTY_PRINT pre-applied.
Example
echo json_encode_pretty(["x" => 1]), " ";
{
"x": 1
}