#json-file-plus 


A module to read from and write to JSON files, without losing formatting, to minimize diffs.
Example
var jsonFile = require('json-file-plus');
var path = require('path');
var filename = path.join(process.cwd(), 'package.json');
jsonFile(filename, function (err, file) {
if (err) { return doSomethingWithError(err); }
file.data;
file.format;
file.get('version');
file.get('version', callback);
file.get();
file.get(callback);
file.set({
foo: 'bar',
bar: {
baz: true
}
});
file.filename = path.join(process.cwd(), 'new-package.json');
file.save(fsWriteFileCallback);
});
Tests
Simply run npm test
in the repo