<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.bson.functions.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'function.mongodb.bson-fromjson.php',
    1 => 'MongoDB\\BSON\\fromJSON',
    2 => 'Returns the BSON representation of a JSON value',
  ),
  'up' => 
  array (
    0 => 'ref.bson.functions.php',
    1 => 'Функції',
  ),
  'prev' => 
  array (
    0 => 'ref.bson.functions.php',
    1 => 'Функції',
  ),
  'next' => 
  array (
    0 => 'function.mongodb.bson-fromphp.php',
    1 => 'MongoDB\\BSON\\fromPHP',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/mongodb/functions/bson/fromjson.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.mongodb.bson-fromjson" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoDB\BSON\fromJSON</h1>
  <p class="verinfo">(mongodb &gt;=1.0.0)</p><p class="refpurpose"><span class="refname">MongoDB\BSON\fromJSON</span> &mdash; <span class="dc-title">Returns the BSON representation of a JSON value</span></p>

 </div>

 <div id="function.mongodb.bson-fromjson-refsynopsisdiv">
  <div class="warning"><strong class="warning">Увага</strong>
   <p class="para">
    This function has been <em>DEPRECATED</em> as of extension
    version 1.20.0 and was removed in 2.0. Applications should use
    <span class="methodname"><a href="mongodb-bson-document.fromjson.php" class="methodname">MongoDB\BSON\Document::fromJSON()</a></span> instead.
   </p>
  </div>
 </div>

 <div class="refsect1 description" id="refsect1-function.mongodb.bson-fromjson-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>MongoDB\BSON\fromJSON</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$json</code></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   Converts an
   <a href="https://www.mongodb.com/docs/manual/reference/mongodb-extended-json/" class="link external">&raquo;&nbsp;extended JSON</a>
   string to its BSON representation.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.mongodb.bson-fromjson-parameters">
  <h3 class="title">Параметри</h3>
  <dl>
   
    <dt><code class="parameter">json</code> (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)</dt>
    <dd>
     <p class="para">
      JSON value to be converted.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.mongodb.bson-fromjson-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   The serialized BSON document as a binary string.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.mongodb.bson-fromjson-errors">
  <h3 class="title">Помилки/виключення</h3>
  <ul class="simplelist">
   <li>
    Throws
    <span class="classname"><a href="class.mongodb-driver-exception-unexpectedvalueexception.php" class="classname">MongoDB\Driver\Exception\UnexpectedValueException</a></span> if
    the JSON value cannot be converted to BSON (e.g. due to a syntax error).
   </li>
  </ul>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.mongodb.bson-fromjson-changelog">
  <h3 class="title">Журнал змін</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Версія</th>
       <th>Опис</th>
      </tr>

     </thead>

     <tbody class="tbody">
      
       <tr>
        <td>PECL mongodb 2.0.0</td>
        <td>
         This function was removed.
        </td>
       </tr>


     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.mongodb.bson-fromjson-examples">
  <h3 class="title">Приклади</h3>
  <div class="example" id="example-1">
   <p><strong>Приклад #1 <span class="function"><strong>MongoDB\BSON\fromJSON()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$json </span><span style="color: #007700">= </span><span style="color: #DD0000">'{ "_id": { "$oid": "563143b280d2387c91807965" } }'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$bson </span><span style="color: #007700">= </span><span style="color: #0000BB">MongoDB\BSON\fromJSON</span><span style="color: #007700">(</span><span style="color: #0000BB">$json</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$value </span><span style="color: #007700">= </span><span style="color: #0000BB">MongoDB\BSON\toPHP</span><span style="color: #007700">(</span><span style="color: #0000BB">$bson</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$value</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Поданий вище приклад
виведе:</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">object(stdClass)#2 (1) {
  [&quot;_id&quot;]=&gt;
  object(MongoDB\BSON\ObjectId)#1 (1) {
    [&quot;oid&quot;]=&gt;
    string(24) &quot;563143b280d2387c91807965&quot;
  }
}</pre>
</div>
   </div>
  </div>
 </div>



 <div class="refsect1 seealso" id="refsect1-function.mongodb.bson-fromjson-seealso">
  <h3 class="title">Прогляньте також</h3>
  <ul class="simplelist">
   <li><span class="methodname"><a href="mongodb-bson-document.fromjson.php" class="methodname" rel="rdfs-seeAlso">MongoDB\BSON\Document::fromJSON()</a> - Construct a new document instance from a JSON string</span></li>
   <li><span class="function"><a href="function.mongodb.bson-tojson.php" class="function" rel="rdfs-seeAlso">MongoDB\BSON\toJSON()</a> - Returns the Legacy Extended JSON representation of a BSON value</span></li>
   <li><a href="https://www.mongodb.com/docs/manual/reference/mongodb-extended-json/" class="link external">&raquo;&nbsp;MongoDB Extended JSON</a></li>
   <li><a href="https://www.mongodb.com/docs/manual/reference/bson-types/" class="link external">&raquo;&nbsp;MongoDB BSON</a></li>
  </ul>
 </div>


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