JsonText
in package
FinalYes
Decode JSON text as json_decode($json, false, 512, JSON_THROW_ON_ERROR) does, keeping every string and member name as written (docs/spec/input-text.md). An unpaired surrogate escape becomes the three-byte encoding of that surrogate and a byte that is not UTF-8 is kept, so both remain text that is not valid UTF-8 and the input text check rejects them. Nothing is replaced.
The file has no dependencies, so a program can load it without an autoloader.
Table of Contents
Constants
- DEPTH : mixed = 512
Properties
Methods
- decode() : mixed
- Decode one JSON document; objects become stdClass values.
- __construct() : mixed
- encode() : string
- Encode a UTF-16 code unit, a surrogate included, in the UTF-8 bit layout.
- fail() : never
- hex() : int
- space() : void
- string() : string
- value() : mixed
Constants
DEPTH
private
mixed
DEPTH
= 512
Properties
$length
private
int
$length
$pos
private
int
$pos
= 0
$text
private
string
$text
Methods
decode()
Decode one JSON document; objects become stdClass values.
public
static decode(string $json) : mixed
Parameters
- $json : string
__construct()
private
__construct(string $text) : mixed
Parameters
- $text : string
encode()
Encode a UTF-16 code unit, a surrogate included, in the UTF-8 bit layout.
private
static encode(int $unit) : string
Parameters
- $unit : int
Return values
stringfail()
private
fail() : never
Return values
neverhex()
private
hex() : int
Return values
intspace()
private
space() : void
string()
private
string() : string
Return values
stringvalue()
private
value(int $depth) : mixed
Parameters
- $depth : int