Json
final class Json
JSON encoder and decoder.
Constants
| deprecated FORCE_ARRAY |
|
| deprecated PRETTY |
|
| deprecated ESCAPE_UNICODE |
|
Methods
static string
encode(mixed $value, bool|int $pretty = false, bool $asciiSafe = false, bool $htmlSafe = false, bool $forceObjects = false)
Converts value to JSON format. Use $pretty for formatted output, $asciiSafe for ASCII-only output, $htmlSafe for HTML-safe output, and $forceObjects to encode non-associative arrays as objects.
static mixed
decode(string $json, bool|int $forceArrays = false)
Decodes a JSON string to a PHP value. Use $forceArrays to decode objects as arrays.
Details
at line 37
static string
encode(mixed $value, bool|int $pretty = false, bool $asciiSafe = false, bool $htmlSafe = false, bool $forceObjects = false)
Converts value to JSON format. Use $pretty for formatted output, $asciiSafe for ASCII-only output, $htmlSafe for HTML-safe output, and $forceObjects to encode non-associative arrays as objects.
at line 70
static mixed
decode(string $json, bool|int $forceArrays = false)
Decodes a JSON string to a PHP value. Use $forceArrays to decode objects as arrays.
Traits
Prevents instantiation.