%META:TOPICPARENT{name="OATDOCIndex"}% ---+ json.js Implements two crucial JSON functions - <tt>parse</tt> and <tt>stringify</tt>. %TOC% ---++ Functions ---+++ OAT.JSON.parse(string) Parses JSON <tt>string</tt>. <b>To prevent JavaScript hijacking attacks, web application authors are encouraged to use some of OAT's built-in countermeasures .</b> ---+++ OAT.JSON.stringify(variable, [maxDepth]) Returns JSON representation of <tt>variable</tt>. The <tt>maxDepth</tt> argument specifies maximum depth for recursive structures; <tt>-1</tt> signifies no depth limit. Cyclic structures are detected and safely interrupted, but could not be further restored. ---+++ Example <verbatim> var a = {x:"y", number:123}; var b = OAT.JSON.stringify(a,-1); var c = OAT.JSON.parse(b); // c now equals </verbatim> CategoryOAT CategoryOpenSource CategoryDocumentation