README
Micro-module for writing JSON easily to disk.
While being able to use require
to read and deserialize a JSON file from disk, there is no such thing to write one.
var writeson = require("writeson");
var data = {
foo: 23,
bar: "fortytwo"
};
writeson("baz.json", data, function(err) {
if(err) return console.err(err);
console.log("Wrote JSON!");
});
var dataRestored = require("./baz.json");
// write the sync way:
writeson.sync("baz.json", data, "\t");
// change default indent when not specified:
writeson.defaultIndent = " ";