As contantes abaixo são definidas por esta extensão e só estarão disponíveis quando a extensão tiver sido compilada no PHP ou tiver sido carregada dinamicamente em tempo de execução.
As seguintes constantes indicam o tipo de erro retornado pela função json_last_error() or armazenadas no code de uma 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
foi
informada, null
será substituído no lugar da referência recursiva.
JSON_ERROR_INF_OR_NAN
(int)
NAN
ou INF
.
Se a opção JSON_PARTIAL_OUTPUT_ON_ERROR
foi
informada, 0
será substituído no lugar do número
especial.
JSON_ERROR_UNSUPPORTED_TYPE
(int)
JSON_PARTIAL_OUTPUT_ON_ERROR
foi
informada, null
será substituída ao invés do valor não suportado.
JSON_ERROR_INVALID_PROPERTY_NAME
(int)
JSON_ERROR_UTF16
(int)
As constantes a seguir podem ser combinadas para formar opções na função json_decode().
JSON_BIGINT_AS_STRING
(int)
JSON_OBJECT_AS_ARRAY
(int)
true
.
As seguintes constantes podem ser combinadas para formar opções para a função 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
é informado. Este é o mesmo
comportamento existente anteriormente ao PHP 7.1 sem essa constante.
Disponível desde o PHP 7.1.0.
As constantes a seguir podem ser combinadas para formar opções para a função json_decode() e json_encode().
JSON_INVALID_UTF8_IGNORE
(int)
JSON_INVALID_UTF8_SUBSTITUTE
(int)
JSON_THROW_ON_ERROR
(int)
JSON_PARTIAL_OUTPUT_ON_ERROR
tem precedência sobre
JSON_THROW_ON_ERROR
.
Disponível desde o PHP 7.3.0.
JSON_ERROR_NON_BACKED_ENUM
(int)