Yet another sweetest json prettifier
npm install json-honey

> Yet another sweetest json prettifier (the best, of course).
This is a simple tool, that convert your objects to JSON format, aligning the values and sorting the keys.honey can also be used in CLI.
Example:
``js
var honey = require("json-honey");
honey({
aaaa: 1,
a: 2,
b: { b: 2, bb: 3, bbb: [1,2,3,null] },
c: new Object
});
`
Will output:
``
{
"aaaa": 1,
"a": 2,
"b": {
"b": 2,
"bb": 3,
"bbb": [
1,
2,
3,
null
]
},
"c": {}
}
#### honey(obj, [options])
##### obj
Type: *
Object to be stringified.
##### options
Type: Object
Optional options.
##### options.pad
Type: number2
Default:
##### options.sortBy
Type: Function|Function[]null
Default:
Function (or list of functions) to be applied at each key-value pair of object. Called with definition object with properties key, value.parents
It also have properties with parent nodes keys list, and scalar flag, that shows is it primitive value or not.
##### options.sortScalar
Type: booleantrue
Default:
Indicates to sort or not by type of value in the object - is it scalar (primitive) (boolean, string, number) or not.
##### options.sortType
Type: booleanfalse
Default:
Indicates to sort or not by type of value. Type catched by Object.prototype.toString.call(value).
##### options.sortKey
Type: booleantrue
Default:
Indicates to sort or not by key.
##### options.scalar
Type: booleanfalse
Default:
Replace circular reference with options.circularValue or not. If false, error will thrown on found circular.
##### options.circularValue
Type: string, boolean, number, null[Circular]
Default:
Replacement value for circular references if options.circular set to true.
Honey supports cli usage. Run:
`bash`
honey
to get usage output.
Of course, via npm.
For usage inside js:
`bash`
npm install json-honey
For usage as CLI:
`bash``
npm install -g json-honey