Json.js

Simple Json parser and Stringyfier, See: http://www.json.org/

License

MIT-style license.

Summary
Json.jsSimple Json parser and Stringyfier, See: http://www.json.org/
JsonSimple Json parser and Stringyfier, See: http://www.json.org/
Properties
toStringConverts an object to a string, to be passed in server-side scripts as a parameter.
evaluateconverts a json string to an javascript Object.

Json

Simple Json parser and Stringyfier, See: http://www.json.org/

Summary
Properties
toStringConverts an object to a string, to be passed in server-side scripts as a parameter.
evaluateconverts a json string to an javascript Object.

Properties

toString

Converts an object to a string, to be passed in server-side scripts as a parameter.  Although its not normal usage for this class, this method can also be used to convert functions and arrays to strings.

Arguments

objthe object to convert to string

Returns

A json string

Example

Json.toString({apple: 'red', lemon: 'yellow'}); '{"apple":"red","lemon":"yellow"}'

evaluate

converts a json string to an javascript Object.

Arguments

strthe string to evaluate. if its not a string, it returns false.
secureoptionally, performs syntax check on json string.  Defaults to false.

Credits

Json test regexp is by Douglas Crockford http://crockford.org.

Example

var myObject = Json.evaluate('{"apple":"red","lemon":"yellow"}');
//myObject will become {apple: 'red', lemon: 'yellow'}

Documentation by Aaron Newton & Mootools Developers, generated by NaturalDocs and GeSHi