JsonEncode
in package
implements
EncoderInterface
Encodes JSON data.
Tags
Interfaces, Classes, Traits and Enums
Table of Contents
- OPTIONS = 'json_encode_options'
- $defaultContext : mixed
- __construct() : mixed
- encode() : string
- Encodes PHP data to a JSON string.
- supportsEncoding() : bool
- Checks whether the serializer can encode to given format.
Constants
OPTIONS
public
mixed
OPTIONS
= 'json_encode_options'
Properties
$defaultContext
private
mixed
$defaultContext
= [self::OPTIONS => 0]
Methods
__construct()
public
__construct([array<string|int, mixed> $defaultContext = [] ]) : mixed
Parameters
- $defaultContext : array<string|int, mixed> = []
Return values
mixed —encode()
Encodes PHP data to a JSON string.
public
encode(mixed $data, mixed $format[, array<string|int, mixed> $context = [] ]) : string
Parameters
- $data : mixed
-
Data to encode
- $format : mixed
-
Format name
- $context : array<string|int, mixed> = []
-
Options that normalizers/encoders have access to
Return values
string —supportsEncoding()
Checks whether the serializer can encode to given format.
public
supportsEncoding(mixed $format) : bool
Parameters
- $format : mixed
-
Format name