Package Exports
- w-json
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (w-json) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
w-json

A small module to write JSON files.
If you want to read JSON files, check out r-json
.
☁️ Installation
$ npm i --save w-json
📋 Example
// Dependencies
var WriteJson = require("w-json");
// Write the same file synchronously
WriteJson(__dirname + "/test.json", { "hello": "mars" });
// 4 space indent and new line at the end
WriteJson(__dirname + "/test.json", { "hello": "mars" }, {
new_line: true
, space: 4
});
// Write test.json asynchronously
WriteJson(__dirname + "/test.json", { "hello": "world" }, function (err, data) {
console.log(err || "written");
});
📝 Documentation
wJson(path, data, options, callback)
Writes a JSON file.
Params
String
path
: The JSON file path.Object
data
: The JSON data to write in the provided file.Object|Number|Boolean
options
: An object containing the fields below. If boolean, it will be handled asnew_line
, if number it will be handled asspace
.space
(Number): An optional space value for beautifying the json output (default:2
).new_line
(Boolean): Iftrue
, a new line character will be added at the end of the stringified content.Function
callback
: An optional callback. If not passed, the function will run in sync mode.
😋 How to contribute
Have an idea? Found a bug? See how to contribute.
💫 Where is this library used?
If you are using this library in one of your projects, add it in this list. ✨
bible
—Read the Holy Bible via the command line.birthday
—Know when a friend's birthday is coming.blah
—A command line tool to optimize the repetitive actions.cdnjs-importer
—Easy way to import a library into CDNJS.cli-sunset
—A fancy command line tool for knowing the sunset time.engine-app
(by jillix)—Engine app related helper functions.engine-composition-crud
(by jillix)—The default module for creating, reading, updating and deleting Engine instances.engine-parser
(by jillix)—Engine composition parser.engine-tools
(by jillix)—Engine Tools library and CLI app.git-stats
—Local git statistics including GitHub-like contributions calendars.idea
—A lightweight CLI tool and module for keeping ideas in a safe place quick and easy.packy
—Set default fields in your package.json files.tithe
—Organize and track the tithe payments.w-package-json
—Write package.json files.web-term
—A full screen terminal in your browser.