0.9.0 • Published 5 years ago

@ams-team/json-stringify v0.9.0

Weekly downloads
10
License
-
Repository
-
Last release
5 years ago

@ams-team/json-stringify

example

var stringify = require('@ams-team/json-stringify');
var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 };
console.log(stringify(obj));

output:

{"a":3,"b":[{"x":4,"y":5,"z":6},7],"c":8}

methods

var stringify = require('@ams/json-stringify')

var str = stringify(obj, opts)

Return a deterministic stringified string str from the object obj.

options

cycles

Pass true in opts.cycles to stringify circular property as __cycle__ - the result will not be a valid JSON string in this case.

TypeError will be thrown in case of circular object without this option.