CRUDUI PHP API

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

$length  : int
$pos  : int
$text  : string

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

Properties

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
string

fail()

private fail() : never
Return values
never

hex()

private hex() : int
Return values
int

string()

private string() : string
Return values
string

value()

private value(int $depth) : mixed
Parameters
$depth : int
On this page

Search results