toJSON
1.5.1

toJSON(obj) -> String

Returns a JSON string.

For more information on Prototype’s JSON encoder, hop to our tutorial.

Example


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