class Json

Constants

MAXIMUM_NESTING_DEPTH

Maximum number of nested JSON containers.

Methods

static string
encode(mixed $data, int $flags = JSON_UNESCAPED_UNICODE, int $depth = self::MAXIMUM_NESTING_DEPTH)

Encode a value to JSON.

static mixed
decode(string $json, bool $assoc = true, int $depth = self::MAXIMUM_NESTING_DEPTH, int $flags = 0)

Decode a JSON string.

static bool
validate(string $json, int $depth = self::MAXIMUM_NESTING_DEPTH, int $flags = 0)

Validate a JSON string.

Details

at line 21
static string encode(mixed $data, int $flags = JSON_UNESCAPED_UNICODE, int $depth = self::MAXIMUM_NESTING_DEPTH)

Encode a value to JSON.

Parameters

mixed $data
int $flags
int $depth

Return Value

string

Exceptions

JsonException

at line 40
static mixed decode(string $json, bool $assoc = true, int $depth = self::MAXIMUM_NESTING_DEPTH, int $flags = 0)

Decode a JSON string.

Parameters

string $json
bool $assoc
int $depth
int $flags

Return Value

mixed

Exceptions

JsonException

at line 50
static bool validate(string $json, int $depth = self::MAXIMUM_NESTING_DEPTH, int $flags = 0)

Validate a JSON string.

Parameters

string $json
int $depth
int $flags

Return Value

bool