<docbook><section><title>OATDOCjson</title><para> </para>
<title> json.js</title> json.js
<para>Implements two crucial JSON functions - <computeroutput>parse</computeroutput> and <computeroutput>stringify</computeroutput>.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> Functions</bridgehead>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.JSON.parse(string)</bridgehead>
<para>Parses JSON <computeroutput>string</computeroutput>.</para>
<emphasis>To prevent <ulink url="JavaScript">JavaScript</ulink> hijacking attacks, web application authors are encouraged to use some of OAT&#39;s built-in countermeasures .</emphasis><bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.JSON.stringify(variable, [maxDepth])</bridgehead>
<para>Returns JSON representation of <computeroutput>variable</computeroutput>.
 The <computeroutput>maxDepth</computeroutput> argument specifies maximum depth for recursive structures; <computeroutput>-1</computeroutput> signifies no depth limit.</para>
<para>Cyclic structures are detected and safely interrupted, but could not be further restored.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> Example</bridgehead>
<programlisting>var a = {x:&quot;y&quot;, number:123};
var b = OAT.JSON.stringify(a,-1);
var c = OAT.JSON.parse(b); // c now equals
</programlisting><para> <ulink url="CategoryOAT">CategoryOAT</ulink> <ulink url="CategoryOpenSource">CategoryOpenSource</ulink> <ulink url="CategoryDocumentation">CategoryDocumentation</ulink></para>
</section></docbook>