{
  "name": "jsonfile",
  "version": "2.2.1",
  "description": "Easily read/write JSON files.",
  "repository": {
    "type": "git",
    "url": "git@github.com:jprichardson/node-jsonfile.git"
  },
  "keywords": [
    "read",
    "write",
    "file",
    "json",
    "fs",
    "fs-extra"
  ],
  "author": {
    "name": "JP Richardson",
    "email": "jprichardson@gmail.com"
  },
  "license": "MIT",
  "dependencies": {},
  "devDependencies": {
    "mocha": "2.x",
    "rimraf": "^2.4.0",
    "standard": "4.x"
  },
  "main": "index.js",
  "scripts": {
    "test": "standard && mocha test"
  },
  "readme": "Node.js - jsonfile\n================\n\nEasily read/write JSON files.\n\n[![build status](https://secure.travis-ci.org/jprichardson/node-jsonfile.svg)](http://travis-ci.org/jprichardson/node-jsonfile)\n\n\nWhy?\n----\n\nWriting `JSON.stringify()` and then `fs.writeFile()` and `JSON.parse()` with `fs.readFile()` enclosed in `try/catch` blocks became annoying.\n\n\n\nInstallation\n------------\n\n    npm install jsonfile --save\n\n\n\nAPI\n---\n\n### readFile(filename, [options], callback)\n\n`options`: Pass in any `fs.readFile` options or set `reviver` for a [JSON reviver](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse).\n\n\n```js\nvar jsonfile = require('jsonfile')\nvar util = require('util')\n\nvar file = '/tmp/data.json'\njsonfile.readFile(file, function(err, obj) {\n  console.dir(obj)\n})\n```\n\n\n### readFileSync(filename, [options])\n\n`options`: Pass in any `fs.readFileSync` options or set `reviver` for a [JSON reviver](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse). Also `throws` set to `false` if you don't ever want this method\nto throw on invalid JSON. Will return `null` instead. Defaults to `true`.\n\n```js\nvar jsonfile = require('jsonfile')\nvar util = require('util')\n\nvar file = '/tmp/data.json'\n\nconsole.dir(jsonfile.readFileSync(file))\n```\n\n\n### writeFile(filename, [options], callback)\n\n`options`: Pass in any `fs.writeFile` options or set `replacer` for a [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). Can also pass in `spaces`.\n\n\n```js\nvar jsonfile = require('jsonfile')\n\nvar file = '/tmp/data.json'\nvar obj = {name: 'JP'}\n\njsonfile.writeFile(file, obj, function (err) {\n  console.error(err)\n})\n```\n\n**formatting with spaces:**\n\n```js\nvar jsonfile = require('jsonfile')\n\nvar file = '/tmp/data.json'\nvar obj = {name: 'JP'}\n\njsonfile.writeFile(file, obj, {spaces: 2}, function(err) {\n  console.error(err)\n})\n```\n\n\n### writeFileSync(filename, [options])\n\n`options`: Pass in any `fs.writeFileSync` options or set `replacer` for a [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). Can also pass in `spaces`.\n\n```js\nvar jsonfile = require('jsonfile')\n\nvar file = '/tmp/data.json'\nvar obj = {name: 'JP'}\n\njsonfile.writeFileSync(file, obj)\n```\n\n**formatting with spaces:**\n\n```js\nvar jsonfile = require('jsonfile')\n\nvar file = '/tmp/data.json'\nvar obj = {name: 'JP'}\n\njsonfile.writeFileSync(file, obj, {spaces: 2})\n```\n\n\n\n### spaces\n\nGlobal configuration to set spaces to indent JSON files.\n\n**default:** `null`\n\n```js\nvar jsonfile = require('jsonfile')\n\njsonfile.spaces = 4;\n\nvar file = '/tmp/data.json'\nvar obj = {name: 'JP'}\n\n// json file has four space indenting now\njsonfile.writeFile(file, obj, function (err) {\n  console.error(err)\n})\n```\n\nNote, it's bound to `this.spaces`. So, if you do this:\n\n```js\nvar myObj = {}\nmyObj.writeJsonSync = jsonfile.writeFileSync\n// => this.spaces = null\n```\n\nCould do the following:\n\n```js\nvar jsonfile = require('jsonfile')\njsonfile.spaces = 4\njsonfile.writeFileSync(file, obj) // will have 4 spaces indentation\n\nvar myCrazyObj = {spaces: 32}\nmyCrazyObj.writeJsonSync = jsonfile.writeFileSync\nmyCrazyObj.writeJsonSync(file, obj) // will have 32 space indentation\nmyCrazyObj.writeJsonSync(file, obj, {spaces: 2}) // will have only 2\n```\n\n\nLicense\n-------\n\n(MIT License)\n\nCopyright 2012-2015, JP Richardson  <jprichardson@gmail.com>\n\n\n\n\n\n",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/jprichardson/node-jsonfile/issues"
  },
  "homepage": "https://github.com/jprichardson/node-jsonfile",
  "_id": "jsonfile@2.2.1",
  "dist": {
    "shasum": "c10690b1653c912474dc8e04cadaa57297b79973"
  },
  "_from": "jsonfile@^2.1.0",
  "_resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.2.1.tgz"
}
