json-string
A JSON formatter with support for sorting keys and more.
Install
$ npm install --save json-string
Example
var json = ; var string = ; console;// {// "foo": "bar",// "hello": "world",// "number": 5// }
API
json(input, [options])
Formats the input
value as a string. (any value can be passed for input, not
just objects)
Available options
:
replacer
(function) - Used to format object properties. (see docs)sortKeys
(boolean) - If set tofalse
, object keys will not be sorted.spaces
(number) - Used to set indentation levels. (see docs)
json.defaults
Exposed to allow for overriding the default options.