The constants below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime.
The following constants indicate the type of error returned by json_last_error() or stored as the code of a JsonException.
JSON_ERROR_NONE
(int)
JSON_ERROR_DEPTH
(int)
JSON_ERROR_STATE_MISMATCH
(int)
JSON_ERROR_CTRL_CHAR
(int)
JSON_ERROR_SYNTAX
(int)
JSON_ERROR_UTF8
(int)
JSON_ERROR_RECURSION
(int)
JSON_PARTIAL_OUTPUT_ON_ERROR
option was
given, null
will be encoded in the place of the recursive reference.
JSON_ERROR_INF_OR_NAN
(int)
NAN
or INF
.
If the JSON_PARTIAL_OUTPUT_ON_ERROR
option was
given, 0
will be encoded in the place of these
special numbers.
JSON_ERROR_UNSUPPORTED_TYPE
(int)
JSON_PARTIAL_OUTPUT_ON_ERROR
option was
given, null
will be encoded in the place of the unsupported value.
JSON_ERROR_INVALID_PROPERTY_NAME
(int)
JSON_ERROR_UTF16
(int)
The following constants can be combined to form options for json_decode().
JSON_BIGINT_AS_STRING
(int)
JSON_OBJECT_AS_ARRAY
(int)
true
.
The following constants can be combined to form options for json_encode().
JSON_HEX_TAG
(int)
JSON_HEX_AMP
(int)
JSON_HEX_APOS
(int)
JSON_HEX_QUOT
(int)
JSON_FORCE_OBJECT
(int)
JSON_NUMERIC_CHECK
(int)
JSON_PRETTY_PRINT
(int)
JSON_UNESCAPED_SLASHES
(int)
/
.
JSON_UNESCAPED_UNICODE
(int)
JSON_PARTIAL_OUTPUT_ON_ERROR
(int)
JSON_PRESERVE_ZERO_FRACTION
(int)
JSON_UNESCAPED_LINE_TERMINATORS
(int)
JSON_UNESCAPED_UNICODE
is supplied. It uses the same
behaviour as it was before PHP 7.1 without this constant.
Available as of PHP 7.1.0.
The following constants can be combined to form options for json_decode() and json_encode().
JSON_INVALID_UTF8_IGNORE
(int)
JSON_INVALID_UTF8_SUBSTITUTE
(int)
JSON_THROW_ON_ERROR
(int)
JSON_PARTIAL_OUTPUT_ON_ERROR
takes precedence over
JSON_THROW_ON_ERROR
.
Available as of PHP 7.3.0.