json-honey v0.4.1
JSON-HONEY
Yet another sweetest json prettifier (the best, of course).

Whatsup
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:
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": {}
}API
honey(obj, options)
obj
Type: *
Object to be stringified.
options
Type: Object
Optional options.
options.pad
Type: number
Default: 2
options.sortBy
Type: Function|Function[]
Default: null
Function (or list of functions) to be applied at each key-value pair of object. Called with definition object with properties key, value.
It also have properties parents with parent nodes keys list, and scalar flag, that shows is it primitive value or not.
options.sortScalar
Type: boolean
Default: true
Indicates to sort or not by type of value in the object - is it scalar (primitive) (boolean, string, number) or not.
options.sortType
Type: boolean
Default: false
Indicates to sort or not by type of value. Type catched by Object.prototype.toString.call(value).
options.sortKey
Type: boolean
Default: true
Indicates to sort or not by key.
options.scalar
Type: boolean
Default: false
Replace circular reference with options.circularValue or not. If false, error will thrown on found circular.
options.circularValue
Type: string, boolean, number, null
Default: [Circular]
Replacement value for circular references if options.circular set to true.
CLI
Honey supports cli usage. Run:
honeyto get usage output.
Install
Of course, via npm.
For usage inside js:
npm install json-honeyFor usage as CLI:
npm install -g json-honey