# write-json [![NPM version](https://badge.fury.io/js/write-json.svg)](http://badge.fury.io/js/write-json)  [![Build Status](https://travis-ci.org/jonschlinkert/write-json.svg)](https://travis-ci.org/jonschlinkert/write-json)

> Write a JSON file to disk, also creates intermediate directories in the destination path if they don't already exist.

## Install

Install with [npm](https://www.npmjs.com/)

```sh
$ npm i write-json --save
```

## Usage

```js
var writeJson = require('write-json'); 

// async
writeJson('foo.json', {abc: 'xyz'}, function(err) {
  if (err) console.log(err);
});

// sync
writeJson.sync('foo.json', , {abc: 'xyz'});
```

## Related

* [delete](https://www.npmjs.com/package/delete): Delete files and folders and any intermediate directories if they exist (sync and async). | [homepage](https://github.com/jonschlinkert/delete)
* [read-data](https://www.npmjs.com/package/read-data): Read JSON or YAML files. | [homepage](https://github.com/jonschlinkert/read-data)
* [read-json](https://www.npmjs.com/package/read-json): Reads and parses a JSON file. | [homepage](https://github.com/azer/read-json#readme)
* [read-yaml](https://www.npmjs.com/package/read-yaml): Very thin wrapper around js-yaml for directly reading in YAML files. | [homepage](https://github.com/jonschlinkert/read-yaml)
* [write](https://www.npmjs.com/package/write): Write files to disk, creating intermediate directories if they don't exist. | [homepage](https://github.com/jonschlinkert/write)
* [write-yaml](https://www.npmjs.com/package/write-yaml): Write YAML. Converts JSON to YAML writes it to the specified file. | [homepage](https://github.com/jonschlinkert/write-yaml)

## Running tests

Install dev dependencies:

```sh
$ npm i -d && npm test
```

## Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/write-json/issues/new).

## Author

**Jon Schlinkert**

+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

## License

Copyright © 2015 Jon Schlinkert
Released under the MIT license.

***

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on November 17, 2015._