简单的JSON解析器和组装器。更多关于JSON的信息可参见: http://www.json.org/
把一个对象转换为一个字符串。 这个方法也可以把函数和数组转换成字符串,尽管这个方法不是这个类的正常使用方法。
obj | 要转换成字符串的对象 |
一个json字符串
Json.toString({apple: 'red', lemon: 'yellow'});
//结果 '{"apple":"red","lemon":"yellow"}'
把一个json字符串转换为一个javascript对象。
str | 要转换的字符串。如果不是字符串,则返回false |
secure | 可选, 是否检查字符串中的json语法。默认为false. |
Json test regexp is by Douglas Crockford http://crockford.org.
var myObject = Json.evaluate('{"apple":"red","lemon":"yellow"}'); //myObject为 {apple: 'red', lemon: 'yellow'}
Documentation by Aaron Newton & Mootools Developers, generated by NaturalDocs and tidy, and GeSHi
文档中文翻译:zarknight 勘误Email:zarknight@gmail.com asp之家