<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/xdmp.fromJSON.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>xdmp.fromJSON</api:function-name><api:suggest>xdmp.fromjson</api:suggest><api:suggest>xdmp</api:suggest><api:suggest>fromjson</api:suggest><api:function mode="javascript" name="fromJSON" type="builtin" lib="xdmp" category="Extension" subcategory="JSON" class="javascript" hidden="false" bucket="MarkLogic Built-In Functions" prefix="xdmp" namespace="http://marklogic.com/xdmp" fullname="xdmp.fromJSON"><api:summary>
  Atomizes a JSON node, returning a JSON value.
</api:summary><api:params><api:param name="arg" type="node()"><api:param-description>
    A node of kind <code xmlns="http://www.w3.org/1999/xhtml">object-node()</code>, <code xmlns="http://www.w3.org/1999/xhtml">array-node()</code>,
    <code xmlns="http://www.w3.org/1999/xhtml">text()</code>, <code xmlns="http://www.w3.org/1999/xhtml">number-node()</code>, <code xmlns="http://www.w3.org/1999/xhtml">boolean-node()</code>,
    <code xmlns="http://www.w3.org/1999/xhtml">null-node()</code>, or <code xmlns="http://www.w3.org/1999/xhtml">document-node()</code>.
  </api:param-description><api:param-name>arg</api:param-name><api:param-type>Node</api:param-type></api:param></api:params><api:return>ValueIterator</api:return><api:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">An <code>object-node()</code> atomizes as a <code>json:object</code>.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">An <code>array-node()</code> atomizes as a <code>json:array</code>.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">A <code>null-node()</code> atomizes as an empty sequence.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">A <code>boolean-node()</code> atomizes as an <code>xs:boolean</code>.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">A <code>number-node()</code> atomizes as an <code>xs:integer</code>,
     <code>xs:decimal</code>, or <code>xs:double</code> value.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">A <code>text()</code> node atomizes as an <code>xs:untypedAtomic</code>.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">A <code>document-node()</code> atomizes the same as its root.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">This function returns the same result as <code>fn:data</code>,
     but it only works on JSON nodes.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">To make a JSON node from a string, use <code>xdmp:unquote</code>
     with the <code>"format-json"</code> option.</p>
</api:usage><api:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
xdmp.fromJSON(xdmp.unquote('["a", null, false]',null,"format-json"));
=&gt;
["a", null, false]
  </pre>
</api:example><api:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
var str = '[{"some-key":45683}, "this is a string", 123]';
var node = xdmp.unquote(str,null,"format-json");
xdmp.fromJSON(node);
=&gt;
[{"some-key":45683}, "this is a string", 123]
</pre>
</api:example></api:function></api:function-page>