Skip to content
suckgamoni edited this page May 15, 2013 · 1 revision

Creates a JSON-formatted string from an iteratable object.

Syntax

Return Value

A JSON-formatted string.


Example

var data = {
    a: 1,
    b: 2,
    c: [3, 4, 5],
    d: {
        e: 6,
        f: "foo",
        g: [7, 8]
    }
};
var s = from(data).toJSON();

console.log(s);

/*
This code produces the following output:

{"a": 1, "b": 2, "c": [3, 4, 5], "d": {"e": 6, "f": "foo", "g": [7, 8]}}
*/
Clone this wiki locally