Write stringified object to file.
npm i writejson --save
var writejson = require('writejson');
writejson('data.json', {hello: 'world'}, function(error) {
if (error)
console.error(error.message);
});
try {
writejson.sync('data.json', {hello: 'world'});
} catch(error) {
console.log(error.message);
}
writejson.sync.try('data.json', {hello: 'world'});MIT