Index | OAT homepage | OpenLink Software

# OATDOCjson

- OATDOCjson
- _ _ json.js
- _ _ _ _ Functions
- _ _ _ _ OAT.JSON.parse(string)
- _ _ _ _ OAT.JSON.stringify(variable, [maxDepth])
- _ _ _ _ Example

## json.js

Implements two crucial JSON functions - `parse` and `stringify` .

### Functions

### OAT.JSON.parse(string)

Parses JSON `string` .
To prevent JavaScript hijacking attacks, web application authors are encouraged to use some of OAT's built-in countermeasures .

### OAT.JSON.stringify(variable, [maxDepth])

Returns JSON representation of `variable` . The `maxDepth` argument specifies maximum depth for recursive structures; `-1` signifies no depth limit.
Cyclic structures are detected and safely interrupted, but could not be further restored.

### Example

    var a = {x:"y", number:123};
    var b = OAT.JSON.stringify(a,-1);
    var c = OAT.JSON.parse(b); // c now equals

Copyright (C) 2005-2008 OpenLink Software