<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/book.json.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'pt_BR',
  ),
  'this' => 
  array (
    0 => 'json.constants.php',
    1 => 'Constantes predefinidas',
    2 => 'Constantes predefinidas',
  ),
  'up' => 
  array (
    0 => 'book.json.php',
    1 => 'JSON',
  ),
  'prev' => 
  array (
    0 => 'json.installation.php',
    1 => 'Instala&ccedil;&atilde;o',
  ),
  'next' => 
  array (
    0 => 'class.jsonexception.php',
    1 => 'JsonException',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'pt_BR',
    'path' => 'reference/json/constants.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="json.constants" class="appendix">
 <h1 class="title">Constantes predefinidas</h1>

 <p class="simpara">
As constantes 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.
</p>
 <p class="para">
  As seguintes constantes indicam o tipo de erro retornado pela
  função <span class="function"><a href="function.json-last-error.php" class="function">json_last_error()</a></span> ou armazenadas no <var class="varname">code</var>
  de uma <span class="classname"><a href="class.jsonexception.php" class="classname">JsonException</a></span>
 </p>
 <dl>
  
   <dt id="constant.json-error-none">
    <strong><code><a href="json.constants.php#constant.json-error-none">JSON_ERROR_NONE</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Sem erros.
    </span>
   </dd>
  
  
   <dt id="constant.json-error-depth">
    <strong><code><a href="json.constants.php#constant.json-error-depth">JSON_ERROR_DEPTH</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     O limite de pilha de chamadas foi ultrapassado.
    </span>
   </dd>
  
  
   <dt id="constant.json-error-state-mismatch">
    <strong><code><a href="json.constants.php#constant.json-error-state-mismatch">JSON_ERROR_STATE_MISMATCH</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Ocorre em underflows ou com incongruência de modos.
    </span>
   </dd>
  
  
   <dt id="constant.json-error-ctrl-char">
    <strong><code><a href="json.constants.php#constant.json-error-ctrl-char">JSON_ERROR_CTRL_CHAR</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Erro em caracter de controle, possivelmente erro de codificação.
    </span>
   </dd>
  
  
   <dt id="constant.json-error-syntax">
    <strong><code><a href="json.constants.php#constant.json-error-syntax">JSON_ERROR_SYNTAX</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Erro de sintaxe.
    </span>
   </dd>
  
  
   <dt id="constant.json-error-utf8">
    <strong><code><a href="json.constants.php#constant.json-error-utf8">JSON_ERROR_UTF8</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Caracteres UTF-8 mal formados, possivelmente erro de codificação.
    </span>
   </dd>
  
  
   <dt id="constant.json-error-recursion">
    <strong><code><a href="json.constants.php#constant.json-error-recursion">JSON_ERROR_RECURSION</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     O objeto ou array passado para <span class="function"><a href="function.json-encode.php" class="function">json_encode()</a></span> inclui
     referências recursivas, e não pode ser formatada.
     Se a opção <strong><code><a href="json.constants.php#constant.json-partial-output-on-error">JSON_PARTIAL_OUTPUT_ON_ERROR</a></code></strong> foi
     informada, <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> será substituído no lugar da referência recursiva.
    </span>
   </dd>
  
  
   <dt id="constant.json-error-inf-or-nan">
    <strong><code><a href="json.constants.php#constant.json-error-inf-or-nan">JSON_ERROR_INF_OR_NAN</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Um valor passado para <span class="function"><a href="function.json-encode.php" class="function">json_encode()</a></span> inclui
     <a href="language.types.float.php#language.types.float.nan" class="link"><strong><code><a href="math.constants.php#constant.nan">NAN</a></code></strong></a>
     ou <a href="function.is-infinite.php" class="link"><strong><code><a href="math.constants.php#constant.inf">INF</a></code></strong></a>.
     Se a opção <strong><code><a href="json.constants.php#constant.json-partial-output-on-error">JSON_PARTIAL_OUTPUT_ON_ERROR</a></code></strong> foi
     informada, <code class="literal">0</code> será substituído no lugar do número
     especial.
    </span>
   </dd>
  
  
   <dt id="constant.json-error-unsupported-type">
    <strong><code><a href="json.constants.php#constant.json-error-unsupported-type">JSON_ERROR_UNSUPPORTED_TYPE</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Um valor de um tipo não suportado foi informado para
     <span class="function"><a href="function.json-encode.php" class="function">json_encode()</a></span>, por exemplo um <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span>.
     Se a opção <strong><code><a href="json.constants.php#constant.json-partial-output-on-error">JSON_PARTIAL_OUTPUT_ON_ERROR</a></code></strong> foi
     informada, <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> será substituída ao invés do valor não suportado.
    </span>
   </dd>
  
  
   <dt id="constant.json-error-invalid-property-name">
    <strong><code><a href="json.constants.php#constant.json-error-invalid-property-name">JSON_ERROR_INVALID_PROPERTY_NAME</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Uma chave começando com caracter \u0000 estava na chave string foi passada para
     <span class="function"><a href="function.json-decode.php" class="function">json_decode()</a></span> quando decodificando um objeto JSON para um objeto
     PHP.
    </span>
   </dd>
  
  
   <dt id="constant.json-error-utf16">
    <strong><code><a href="json.constants.php#constant.json-error-utf16">JSON_ERROR_UTF16</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Substituto UTF-16 único não pareado em escape unicode contido na
     string JSON passada para <span class="function"><a href="function.json-decode.php" class="function">json_decode()</a></span>.
    </span>
   </dd>
  
  
   <dt id="constant.json-error-non-backed-enum">
    <strong><code><a href="json.constants.php#constant.json-error-non-backed-enum">JSON_ERROR_NON_BACKED_ENUM</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     O valor passado para <span class="function"><a href="function.json-encode.php" class="function">json_encode()</a></span>
     inclui uma enumeração não apoiada que não pode ser serializada.
     Disponível a partir do PHP 8.1.0.
    </span>
   </dd>
  
 </dl>

 <p class="para">
  As constantes a seguir podem ser combinadas para formar opções na função
  <span class="function"><a href="function.json-decode.php" class="function">json_decode()</a></span>.
 </p>
 <dl>
  
   <dt id="constant.json-bigint-as-string">
    <strong><code><a href="json.constants.php#constant.json-bigint-as-string">JSON_BIGINT_AS_STRING</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Decodifica inteiros grandes como suas strings originais.
    </span>
   </dd>
  
  
   <dt id="constant.json-object-as-array">
    <strong><code><a href="json.constants.php#constant.json-object-as-array">JSON_OBJECT_AS_ARRAY</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Decodifica objetos JSON como arrays PHP. Esta opção pode ser adicionada automaticamente
     quando chamando <span class="function"><a href="function.json-decode.php" class="function">json_decode()</a></span> com o segundo parâmetro
     igual a <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>.
    </span>
   </dd>
  
 </dl>

 <p class="para">
  As seguintes constantes podem ser combinadas para formar opções para a função
  <span class="function"><a href="function.json-encode.php" class="function">json_encode()</a></span>.
 </p>
 <dl>
  
   <dt id="constant.json-hex-tag">
    <strong><code><a href="json.constants.php#constant.json-hex-tag">JSON_HEX_TAG</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Todos os caracteres &lt; e &gt; serão convertidos para \u003C e \u003E.
    </span>
   </dd>
  
  
   <dt id="constant.json-hex-amp">
    <strong><code><a href="json.constants.php#constant.json-hex-amp">JSON_HEX_AMP</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Todos os caracteres &amp; serão convertidos para \u0026.
    </span>
   </dd>
  
  
   <dt id="constant.json-hex-apos">
    <strong><code><a href="json.constants.php#constant.json-hex-apos">JSON_HEX_APOS</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Todos os caracteres &#039; serão convertidos para \u0027.
    </span>
   </dd>
  
  
   <dt id="constant.json-hex-quot">
    <strong><code><a href="json.constants.php#constant.json-hex-quot">JSON_HEX_QUOT</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Todos os caracteres &quot; serão convertidos para \u0022.
    </span>
   </dd>
  
  
   <dt id="constant.json-force-object">
    <strong><code><a href="json.constants.php#constant.json-force-object">JSON_FORCE_OBJECT</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Imprime um objeto em vez de um array quando um array não recursivo é
     usado. Muito útil quando o chamador espera
     um objeto mas o array está vazio.
    </span>
   </dd>
  
  
   <dt id="constant.json-numeric-check">
    <strong><code><a href="json.constants.php#constant.json-numeric-check">JSON_NUMERIC_CHECK</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Codifica strings numéricas como números.
    </span>
   </dd>
  
  
   <dt id="constant.json-pretty-print">
    <strong><code><a href="json.constants.php#constant.json-pretty-print">JSON_PRETTY_PRINT</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Formata os dados retornados com espaços em branco.
    </span>
   </dd>
  
  
   <dt id="constant.json-unescaped-slashes">
    <strong><code><a href="json.constants.php#constant.json-unescaped-slashes">JSON_UNESCAPED_SLASHES</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Não escapa o caracter <code class="literal">/</code>.
    </span>
   </dd>
  
  
   <dt id="constant.json-unescaped-unicode">
    <strong><code><a href="json.constants.php#constant.json-unescaped-unicode">JSON_UNESCAPED_UNICODE</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Codifica caracteres Unicode multibyte literalmente (default é formatar como
     \uXXXX).
    </span>
   </dd>
  
  
   <dt id="constant.json-partial-output-on-error">
    <strong><code><a href="json.constants.php#constant.json-partial-output-on-error">JSON_PARTIAL_OUTPUT_ON_ERROR</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Substitui valores não identificados ao invés de falhar.
    </span>
   </dd>
  
  
   <dt id="constant.json-preserve-zero-fraction">
    <strong><code><a href="json.constants.php#constant.json-preserve-zero-fraction">JSON_PRESERVE_ZERO_FRACTION</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Garante que <span class="type"><a href="language.types.float.php" class="type float">float</a></span> sempre são codificados como um número float.
    </span>
   </dd>
  
  
   <dt id="constant.json-unescaped-line-terminators">
    <strong><code><a href="json.constants.php#constant.json-unescaped-line-terminators">JSON_UNESCAPED_LINE_TERMINATORS</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Os fins de linha são preservados não escapados quando
     <strong><code><a href="json.constants.php#constant.json-unescaped-unicode">JSON_UNESCAPED_UNICODE</a></code></strong> é informado. Este é o mesmo
     comportamento existente anteriormente ao PHP 7.1 sem essa constante.
     Disponível desde o PHP 7.1.0.
    </span>
   </dd>
  
 </dl>

 <p class="para">
  As constantes a seguir podem ser combinadas para formar opções para a função
  <span class="function"><a href="function.json-decode.php" class="function">json_decode()</a></span> e <span class="function"><a href="function.json-encode.php" class="function">json_encode()</a></span>.
 </p>
 <dl>
  
   <dt id="constant.json-invalid-utf8-ignore">
    <strong><code><a href="json.constants.php#constant.json-invalid-utf8-ignore">JSON_INVALID_UTF8_IGNORE</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Ignora caracteres inválidos UTF-8.
     Disponível desde o 7.2.0.
    </span>
   </dd>
  
  
   <dt id="constant.json-invalid-utf8-substitute">
    <strong><code><a href="json.constants.php#constant.json-invalid-utf8-substitute">JSON_INVALID_UTF8_SUBSTITUTE</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Converte caracteres inválidos UTF-8 para \0xfffd
     (Caracter Unicode &#039;REPLACEMENT CHARACTER&#039;)
     Disponível desde o 7.2.0.
    </span>
   </dd>
  
  
   <dt id="constant.json-throw-on-error">
    <strong><code><a href="json.constants.php#constant.json-throw-on-error">JSON_THROW_ON_ERROR</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Lança um <span class="classname"><a href="class.jsonexception.php" class="classname">JsonException</a></span> se ocorrer um erro ao invés
     de carregar o erro global que pode ser obtido com
     <span class="function"><a href="function.json-last-error.php" class="function">json_last_error()</a></span> e <span class="function"><a href="function.json-last-error-msg.php" class="function">json_last_error_msg()</a></span>.
     <strong><code><a href="json.constants.php#constant.json-partial-output-on-error">JSON_PARTIAL_OUTPUT_ON_ERROR</a></code></strong> tem precedência sobre
     <strong><code><a href="json.constants.php#constant.json-throw-on-error">JSON_THROW_ON_ERROR</a></code></strong>.
     Disponível desde o PHP 7.3.0.
    </span>
   </dd>
  
 </dl>

</div>
<?php manual_footer($setup); ?>