Object.toJSON - Prototype JavaScript 框架

Xunxin Prototype API

toJSON
1.5.1

toJSON(obj) -> String

返回一个 JSON 字符串。

关于 Prototype JSON 编码器的更详细的信息,请查看我们的指南

Example

var data = {name: 'Violet', occupation: 'character', age: 25, pets: ['frog', 'rabbit']}; 
Object.toJSON(data); 
//-> '{"name": "Violet", "occupation": "character", "age": 25, "pets": ["frog","rabbit"]}'