<?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 => 'fr',
  ),
  'this' => 
  array (
    0 => 'json.constants.php',
    1 => 'Constantes pr&eacute;-d&eacute;finies',
    2 => 'Constantes pr&eacute;-d&eacute;finies',
  ),
  'up' => 
  array (
    0 => 'book.json.php',
    1 => 'JSON',
  ),
  'prev' => 
  array (
    0 => 'json.installation.php',
    1 => 'Installation',
  ),
  'next' => 
  array (
    0 => 'class.jsonexception.php',
    1 => 'JsonException',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    '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 pré-définies</h1>

 <p class="simpara">Ces constantes sont définies par cette
extension, et ne sont disponibles que si cette extension a été compilée avec
PHP, ou bien chargée au moment de l&#039;exécution.</p>
 <p class="para">
  Les constantes suivantes indiquent le type d&#039;erreur retournée par
  <span class="function"><a href="function.json-last-error.php" class="function">json_last_error()</a></span> ou stockée en tant que <var class="varname">code</var>
  d&#039;une <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">
     Aucune erreur n&#039;est survenue.
    </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">
     La profondeur maximale de la pile a été atteinte.
    </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">
     Survient avec un underflow ou avec une inadéquation des modes.
    </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">
     Erreur lors du contrôle des caractères, probablement encodés incorrectement.
    </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">
     Erreur de syntaxe.
    </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">
     Caractères UTF-8 mal formés, probablement encodés incorrectement.
    </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">
     L&#039;objet ou le tableau passé à la fonction <span class="function"><a href="function.json-encode.php" class="function">json_encode()</a></span>
     inclut les références récursives et ne peuvent être encodées.
     Si l&#039;option <strong><code><a href="json.constants.php#constant.json-partial-output-on-error">JSON_PARTIAL_OUTPUT_ON_ERROR</a></code></strong> a été fournie,
     <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> sera encodé à la place de la référence récursive.
    </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">
     La valeur passée à la fonction <span class="function"><a href="function.json-encode.php" class="function">json_encode()</a></span> inclut soit
     <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>,
     soit <a href="function.is-infinite.php" class="link"><strong><code><a href="math.constants.php#constant.inf">INF</a></code></strong></a>.
     Si l&#039;option <strong><code><a href="json.constants.php#constant.json-partial-output-on-error">JSON_PARTIAL_OUTPUT_ON_ERROR</a></code></strong> a été fournie,
     <code class="literal">0</code> sera encodé à la place de ces nombres spéciaux.
    </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">
     Une valeur d&#039;un type non supporté a été fournie à la fonction
     <span class="function"><a href="function.json-encode.php" class="function">json_encode()</a></span>, par exemple une <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span>.
     Si l&#039;option <strong><code><a href="json.constants.php#constant.json-partial-output-on-error">JSON_PARTIAL_OUTPUT_ON_ERROR</a></code></strong> a été fournie,
     <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> sera encodé à la place de la valeur non supportée.
    </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">
     Une clé commençant par le caractère \u0000 était présente dans la
     chaîne de caractères passée à <span class="function"><a href="function.json-decode.php" class="function">json_decode()</a></span>
     lors d&#039;un décodage d&#039;un objet JSON en un objet 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">
     Substitut UTF-16 simple non apparié dans l&#039;échappement unicode contenu
     dans la chaîne de caractères JSON passée à <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">
     La valeur passée à <span class="function"><a href="function.json-encode.php" class="function">json_encode()</a></span>
     inclut une énumération non prise en charge qui ne peut pas être sérialisée.
     Disponible à partir de PHP 8.1.0.
    </span>
   </dd>
  
 </dl>
 
 <p class="para">
  Les constantes suivantes peuvent être combinées pour former les options de 
  <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">
     Décode les gros entiers sous forme d&#039;une chaîne de caractères.
    </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">
     Décode un objet JSON en tableau PHP. Cette option peut être ajoutée
     automatiquement en appelant <span class="function"><a href="function.json-decode.php" class="function">json_decode()</a></span> avec le
     deuxième paramètre égal à <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>.
    </span>
   </dd>
  
 </dl>
 
 <p class="para">
  Les constantes suivantes peuvent être combinées pour former les options de 
  <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">
     Tous les caractères &lt; et &gt; sont convertis en séquences
     \u003C et \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">
     Tous les caractères &amp; sont convertis en \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">
     Tous les guillemets &#039; sont convertis en \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">
     Tous les guillemets doubles &quot; sont convertis en \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">
     Produit un objet plutôt qu&#039;un tableau, lorsqu&#039;un tableau
     non-associatif est utilisé. C&#039;est particulièrement utile lorsque
     le destinataire du résultat attend un objet, et que le tableau
     est vide.
    </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">
     Encode les chaînes numériques en tant que nombres.
    </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">
     Utilise des espaces dans les données retournées pour
     les formater.
    </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">
     Ne pas échapper les caractères <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">
     Encode les caractères multioctets Unicode littéralement (le comportement
     par défaut est de les échapper par \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">
     Substitue certaines valeurs non encodables au lieu d&#039;échouer.
    </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">
    S&#039;assure que les valeurs de type <a href="language.types.float.php" class="link">nombre décimal</a> sont toujours encodées comme
    valeur flottante.
   </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">
     Les terminateurs de ligne sont conservés sans être échappés quand
     <strong><code><a href="json.constants.php#constant.json-unescaped-unicode">JSON_UNESCAPED_UNICODE</a></code></strong> est fourni. Il utilise le même
     comportement qu&#039;avant PHP 7.1 sans cette constante.
     Disponible à partir de PHP 7.1.0.
    </span>
   </dd>
  
 </dl>
 
 <p class="para">
  Les constantes suivantes peuvent être combinées pour former les options de
  <span class="function"><a href="function.json-decode.php" class="function">json_decode()</a></span> et <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">
     Ignore les caractères UTF-8 invalides.
     Disponible à partir de PHP 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">
     Convertit les caractères UTF-8 invalides en \0xfffd
     (Caractère Unicode &#039;REPLACEMENT CHARACTER&#039;).
     Disponible à partir de PHP 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">
     Émet une <span class="classname"><a href="class.jsonexception.php" class="classname">JsonException</a></span> si une erreur se produit
     au lieu de régler l&#039;état d&#039;erreur globale qui est récupéré grâce à
     <span class="function"><a href="function.json-last-error.php" class="function">json_last_error()</a></span> et <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> prend la priorité par rapport à
     <strong><code><a href="json.constants.php#constant.json-throw-on-error">JSON_THROW_ON_ERROR</a></code></strong>.
     Disponible à partir de PHP 7.3.0.
    </span>
   </dd>
  
 </dl>
 
</div>
<?php manual_footer($setup); ?>