Documentation

JsonSerializer
in package
implements Serializer

FinalYes

Table of Contents

Interfaces

Serializer

Constants

THROW_ON_ERROR  = 4194304

Properties

$associative  : bool
$decodeOptions  : int
$depth  : int
$encodeOptions  : int

Methods

serialize()  : string
unserialize()  : mixed
withAssociativeArrays()  : self
Creates a JSON serializer that decodes objects to associative arrays.
withObjects()  : self
Creates a JSON serializer that decodes objects to instances of stdClass.
__construct()  : mixed

Constants

Properties

Methods

serialize()

public serialize(mixed $data) : string
Parameters
$data : mixed
Return values
string

unserialize()

public unserialize(string $data) : mixed
Parameters
$data : string
Return values
mixed

The unserialized data.

withAssociativeArrays()

Creates a JSON serializer that decodes objects to associative arrays.

public static withAssociativeArrays([int $encodeOptions = 0 ][, int $decodeOptions = 0 ][, int $depth = 512 ]) : self
Parameters
$encodeOptions : int = 0

@see \json_encode() options parameter.

$decodeOptions : int = 0

@see \json_decode() options parameter.

$depth : int = 512

Maximum recursion depth.

Return values
self

withObjects()

Creates a JSON serializer that decodes objects to instances of stdClass.

public static withObjects([int $encodeOptions = 0 ][, int $decodeOptions = 0 ][, int $depth = 512 ]) : self
Parameters
$encodeOptions : int = 0

@see \json_encode() options parameter.

$decodeOptions : int = 0

@see \json_decode() options parameter.

$depth : int = 512

Maximum recursion depth.

Return values
self

__construct()

private __construct(bool $associative[, int $encodeOptions = 0 ][, int $decodeOptions = 0 ][, int $depth = 512 ]) : mixed
Parameters
$associative : bool
$encodeOptions : int = 0
$decodeOptions : int = 0
$depth : int = 512

        
On this page

Search results