Estas constantes están definidas por esta extensión y estarán disponibles sólo cuando la extensión haya sido compilada con PHP, o bien sea cargada dinámicamente en ejecución.
Las constantes siguientes indican el tipo de error devuelto por json_last_error() o almacenado como code de una 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
,
null
será codificado en lugar de la referencia recursiva.
JSON_ERROR_INF_OR_NAN
(int)
NAN
,
o INF
.
Si se ha proporcionado la opción JSON_PARTIAL_OUTPUT_ON_ERROR
,
0
será codificado en lugar de estos números especiales.
JSON_ERROR_UNSUPPORTED_TYPE
(int)
JSON_PARTIAL_OUTPUT_ON_ERROR
,
null
será codificado en lugar del valor no soportado.
JSON_ERROR_INVALID_PROPERTY_NAME
(int)
JSON_ERROR_UTF16
(int)
JSON_ERROR_NON_BACKED_ENUM
(int)
Las constantes siguientes pueden ser combinadas para formar las opciones de json_decode().
JSON_BIGINT_AS_STRING
(int)
JSON_OBJECT_AS_ARRAY
(int)
true
.
Las constantes siguientes pueden ser combinadas para formar las opciones de 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
es proporcionado. Utiliza el mismo
comportamiento como si fuera antes de PHP 7.1 sin esta constante.
Disponible a partir de PHP 7.1.0.
Las constantes siguientes pueden ser combinadas para formar las opciones de json_decode() y json_encode().
JSON_INVALID_UTF8_IGNORE
(int)
JSON_INVALID_UTF8_SUBSTITUTE
(int)
JSON_THROW_ON_ERROR
(int)
JSON_PARTIAL_OUTPUT_ON_ERROR
tiene prioridad sobre
JSON_THROW_ON_ERROR
.
Disponible a partir de PHP 7.3.0.