[bool|null$associative = null],
[int$depth = 512],
[int$flags = 0]
Takes a JSON encoded string and converts it into a PHP variable.
The json string being decoded.
This function only works with UTF-8 encoded strings.
PHP implements a superset of JSON as specified in the original RFC 7159.
When true, JSON objects will be returned as associative arrays; when false, JSON objects will be returned as objects. When null, JSON objects will be returned as associative arrays or objects depending on whether JSON_OBJECT_AS_ARRAY is set in the flags.
Maximum nesting depth of the structure being decoded.
Bitmask of JSON_BIGINT_AS_STRING, JSON_INVALID_UTF8_IGNORE, JSON_INVALID_UTF8_SUBSTITUTE, JSON_OBJECT_AS_ARRAY, JSON_THROW_ON_ERROR. The behaviour of these constants is described on the JSON constants page.
Returns the value encoded in json in appropriate PHP type. Values true, false and null are returned as true, false and null respectively. null is returned if the json cannot be decoded or if the encoded data is deeper than the nesting limit.
In the event of a failure to decode, json_last_error can be used to determine the exact nature of the error.
|7.3.0||JSON_THROW_ON_ERROR flags was added.|
|7.2.0||associative is nullable now.|
|7.2.0||JSON_INVALID_UTF8_IGNORE, and JSON_INVALID_UTF8_SUBSTITUTE flags were added.|
|7.1.0||An empty JSON key ("") can be encoded to the empty object property instead of using a key with value _empty_.|