class JsonDecode extends Mutator (View source)

Decode a JSON string to an associative array or object. Associative arrays are the default.

Throws a JsonException if the JSON cannot be decoded.

Traits

Methods

__construct(bool $associative = true, int $depth = 512, int $flags = 0)

No description

mixed
__invoke(mixed $value)

Mutate the input value.

from  Mutator
static JsonDecode
assoc(int $depth = 512, int $flags = 0)

No description

static JsonDecode
make(bool $associative = true, int $depth = 512, int $flags = 0)

No description

mixed
mutate(mixed $value)

Mutate the input value.

static JsonDecode
object(int $depth = 512, int $flags = 0)

No description

string
resolveStringInput(mixed $value)

No description

Details

__construct(bool $associative = true, int $depth = 512, int $flags = 0)

No description

Parameters

bool $associative

Whether to return associative arrays or objects (default: true)

int $depth

The maximum depth (default: 512)

int $flags

Bitmask of JSON decode options. Forces use of JSON_THROW_ON_ERROR (default: 0)

final mixed __invoke(mixed $value)

Mutate the input value.

Parameters

mixed $value

Return Value

mixed

static JsonDecode assoc(int $depth = 512, int $flags = 0)

No description

Parameters

int $depth

The maximum depth (default: 512)

int $flags

Bitmask of JSON decode options. Forces use of JSON_THROW_ON_ERROR (default: 0)

Return Value

JsonDecode

static JsonDecode make(bool $associative = true, int $depth = 512, int $flags = 0)

No description

Parameters

bool $associative

Whether to return associative arrays or objects (default: true)

int $depth

The maximum depth (default: 512)

int $flags

Bitmask of JSON decode options. Forces use of JSON_THROW_ON_ERROR (default: 0)

Return Value

JsonDecode

mixed mutate(mixed $value)

Mutate the input value.

Parameters

mixed $value

Return Value

mixed

static JsonDecode object(int $depth = 512, int $flags = 0)

No description

Parameters

int $depth

The maximum depth (default: 512)

int $flags

Bitmask of JSON decode options. Forces use of JSON_THROW_ON_ERROR (default: 0)

Return Value

JsonDecode

protected string resolveStringInput(mixed $value)

No description

Parameters

mixed $value

Return Value

string