]>
Commit | Line | Data |
---|---|---|
06a3d686 BB |
1 | jsonify |
2 | ======= | |
3 | ||
4 | This module provides Douglas Crockford's JSON implementation without modifying | |
5 | any globals. | |
6 | ||
7 | `stringify` and `parse` are merely exported without respect to whether or not a | |
8 | global `JSON` object exists. | |
9 | ||
10 | methods | |
11 | ======= | |
12 | ||
13 | var json = require('jsonify'); | |
14 | ||
15 | json.parse(source, reviver) | |
16 | --------------------------- | |
17 | ||
18 | Return a new javascript object from a parse of the `source` string. | |
19 | ||
20 | If a `reviver` function is specified, walk the structure passing each name/value | |
21 | pair to `reviver.call(parent, key, value)` to transform the `value` before | |
22 | parsing it. | |
23 | ||
24 | json.stringify(value, replacer, space) | |
25 | -------------------------------------- | |
26 | ||
27 | Return a string representation for `value`. | |
28 | ||
29 | If `replacer` is specified, walk the structure passing each name/value pair to | |
30 | `replacer.call(parent, key, value)` to transform the `value` before stringifying | |
31 | it. | |
32 | ||
33 | If `space` is a number, indent the result by that many spaces. | |
34 | If `space` is a string, use `space` as the indentation. |