-
Notifications
You must be signed in to change notification settings - Fork 0
Encoding and Decoding
Adrian edited this page Apr 1, 2021
·
1 revision
Decodes a json string, using the configured options. This wraps PHP's native json_decode() function.
- string
$jsonThe json string to decode.
Throws PHP's native JsonException if decoding fails. See Handling Errors for more information.
The decoded value on success.
Encodes a value as json, using the configured options. This wraps PHP's native json_encode() function.
Additionally, encoding objects other than stdClass that do not inplement JsonSerializable will error unless $strict = false is passed.
- mixed
$dataThe value to encode. - bool
$strictShould trying to encode non-json-able objects error?
Throws PHP's native JsonException if encoding fails. See Handling Errors for more information.
The encoded json string on success.