{"name":"hjson","description":"A user interface for JSON.","main":"./lib/hjson.js","author":{"name":"Christian Zangl"},"version":"2.3.0","keywords":["json","comments","config","hjson","parser","serializer","human"],"bin":{"hjson":"./bin/hjson"},"scripts":{"test":"node ./test/test.js","lint":"jshint bin/hjson lib/*.js","min":"browserify lib/hjson.js --ignore os -s Hjson -o bundle/hjson.js && node node_modules/uglify-js/bin/uglifyjs bundle/hjson.js --comments -c -m -o bundle/hjson.min.js","ver":"node -e 'console.log(\"module.exports=\\\"\"+eval(\"(\"+process.argv[1]+\")\").version+\"\\\";\");' -- \"`cat package.json`\" > lib/hjson-version.js","ver2":"node -e 'var v=\" * Hjson v\"+eval(\"(\"+process.argv[1]+\")\").version; if (v!==process.argv[2]) throw new Error(\"ver\");' -- \"`cat package.json`\" \"`grep -E '\\* Hjson v.*$' lib/hjson.js`\"","prep":"npm run ver && npm run ver2 && npm run test && npm run lint && npm run min"},"homepage":"http://hjson.org","repository":{"type":"git","url":"git+https://github.com/hjson/hjson-js.git"},"bugs":{"url":"https://github.com/hjson/hjson-js/issues"},"license":"MIT","devDependencies":{"uglify-js":"^2.4.24"},"gitHead":"07e0c5f0ccaec049be749f89b2647eaae9bd2499","_id":"hjson@2.3.0","_shasum":"ce9ffeeb9c293c0d80ce691b86497efab2d6c768","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.2.2","_npmUser":{"name":"laktak","email":"coralllama@gmail.com"},"dist":{"shasum":"ce9ffeeb9c293c0d80ce691b86497efab2d6c768","tarball":"http://registry-npm.ywwl.com/hjson/download/hjson-2.3.0.tgz","integrity":"sha512-9DYMkKU1pNnHGfuUE2TR5WNWpLGrnH8OYd48TuBDy/PoVs8zwv1+l2k0dPETokPwnpc45GURNOlUElfh3Fh8cg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF2bfgYx7M25WpDAG5XnfOooYCpHOofbiOJwQpiIMEfBAiBAdeaRW6VG6pBvw+ePo6dfrm6QMD9zgYctaX5ctVVC6g=="}],"size":36336,"noattachment":false,"key":"/hjson/-/hjson-2.3.0.tgz"},"maintainers":[{"name":"laktak","email":"coralllama@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/hjson-2.3.0.tgz_1476308454752_0.866776161827147"},"directories":{},"readme":"# hjson-js\n\n[![Build Status](https://img.shields.io/travis/hjson/hjson-js.svg?style=flat-square)](http://travis-ci.org/hjson/hjson-js)\n[![NPM version](https://img.shields.io/npm/v/hjson.svg?style=flat-square)](http://www.npmjs.com/package/hjson)\n[![License](https://img.shields.io/github/license/hjson/hjson-js.svg?style=flat-square)](https://github.com/hjson/hjson-js/blob/master/LICENSE)\n\n[Hjson](https://hjson.github.io), a user interface for JSON\n\n![Hjson Intro](https://hjson.github.io/hjson1.gif)\n\nJSON is easy for humans to read and write... in theory. In practice JSON gives us plenty of opportunities to make mistakes without even realizing it.\n\nHjson is a syntax extension to JSON. It's NOT a proposal to replace JSON or to incorporate it into the JSON spec itself. It's intended to be used like a user interface for humans, to read and edit before passing the JSON data to the machine.\n\n```Hjson\n{\n  # specify rate in requests/second (because comments are helpful!)\n  rate: 1000\n\n  // prefer c-style comments?\n  /* feeling old fashioned? */\n\n  # did you notice that rate doesn't need quotes?\n  hey: look ma, no quotes for strings either!\n\n  # best of all\n  notice: []\n  anything: ?\n\n  # yes, commas are optional!\n}\n```\n\nThe JavaScript implementation of Hjson is based on [JSON-js](https://github.com/douglascrockford/JSON-js). For other platforms see [hjson.github.io](https://hjson.github.io).\n\n# Install from npm\n\n```\nnpm install hjson\n```\n\n# Usage\n\n```\nvar Hjson = require('hjson');\n\nvar obj = Hjson.parse(hjsonText);\nvar text2 = Hjson.stringify(obj);\n```\n\nTo keep comments intact see [API](#modify--keep-comments).\n\n## From the Commandline\n\nInstall with `npm install hjson -g`.\n\n```\nUsage:\n  hjson [OPTIONS]\n  hjson [OPTIONS] INPUT\n  hjson (-h | --help | -?)\n  hjson (-V | --version)\n\nINPUT can be in JSON or Hjson format. If no file is given it will read from stdin.\nThe default is to output as Hjson.\n\nOptions:\n  (-j | -json)  output as formatted JSON.\n  (-c | -json=compact)  output as JSON.\nOptions for Hjson output:\n  -sl         output the opening brace on the same line\n  -quote      quote all strings\n  -quote=all  quote keys as well\n  -js         output in JavaScript/JSON compatible format\n              can be used with -rt and // comments\n  -rt         round trip comments\n  -nocol      disable colors\n  -cond=n     set condense option (default 60, 0 to disable)\n\nDomain specific formats are optional extensions to Hjson and can be enabled with the following options:\n  +math: support for Inf/inf, -Inf/-inf, Nan/naN and -0\n  +hex: parse hexadecimal numbers prefixed with 0x\n  +date: support ISO dates\n```\n\nSample:\n- run `hjson -j test.hjson > test.json` to convert to JSON\n- run `hjson test.json > test.hjson` to convert to Hjson\n- run `hjson test.json` to view colorized output\n\n\n# API\n\nThe API is the same for the browser and node.js version.\n\n**NOTE that the DSF api is considered experimental**\n\n### Hjson.parse(text, options)\n\nThis method parses *JSON* or *Hjson* text to produce an object or array.\n\n- *text*: the string to parse as JSON or Hjson\n- *options*: object\n  - *keepWsc*: boolean, keep white space and comments. This is useful if you want to edit an hjson file and save it while preserving comments (default false)\n\n### Hjson.stringify(value, options)\n\nThis method produces Hjson text from a JavaScript value.\n\n- *value*: any JavaScript value, usually an object or array.\n- *options*: object\n  - *keepWsc*: boolean, keep white space. See parse.\n  - *condense*: integer, will try to fit objects/arrays onto one line. Default 0 (off).\n  - *bracesSameLine*: boolean, makes braces appear on the same line as the key name. Default false.\n  - *emitRootBraces*: boolean, show braces for the root object. Default true.\n  - *quotes*: string, controls how strings are displayed. (setting separator implies \"strings\")\n    - \"min\": no quotes whenever possible (default)\n    - \"keys\": use quotes around keys\n    - \"strings\": use quotes around string values\n    - \"all\": use quotes around keys and string values\n  - *multiline*: string, controls how multiline strings are displayed. (setting quotes implies \"off\")\n    - \"std\": strings containing \\n are shown in multiline format (default)\n    - \"no-tabs\": like std but disallow tabs\n    - \"off\": show in JSON format\n  - *separator*: boolean, output a comma separator between elements. Default false\n  - *space*: specifies the indentation of nested structures. If it is a number, it will specify the number of spaces to indent at each level. If it is a string (such as '\\t' or '&nbsp;'), it contains the characters used to indent at each level.\n  - *eol*: specifies the EOL sequence (default is set by Hjson.setEndOfLine())\n  - *colors*: boolean, output ascii color codes\n  - *serializeDeterministically*: boolean, when serializing objects into hjson, order the keys based on their UTF-16 code units order. Default false.\n\n### Hjson.endOfLine(), .setEndOfLine(eol)\n\nGets or sets the stringify EOL sequence ('\\n' or '\\r\\n'). When running with node.js this defaults to os.EOL.\n\n### Hjson.rt { parse, stringify }\n\nThis is a shortcut to roundtrip your comments when reading and updating a config file. It is the same as specifying the keepWsc option for the parse and stringify functions.\n\n### Hjson.version\n\nThe version number.\n\n### require-hook\n\nRequire a config file directly.\n\n```\nrequire(\"hjson/lib/require-config\");\nvar cfg=require(\"./config.hjson\");\n```\n\n## modify & keep comments\n\nYou can modify a Hjson file and keep the whitespace & comments intact (round trip). This is useful if an app updates its config file.\n\n```\n// parse, keep whitespace and comments\n// (they are stored in a non enumerable __COMMENTS__ member)\nvar data = Hjson.rt.parse(text);\n\n// modify like you normally would\ndata.foo = \"text\";\n\n// convert back to Hjson\nconsole.log(Hjson.rt.stringify(data));\n```\n# Build\n\nTo run all tests and create the bundle output, first install the dev dependencies with `npm i` and then run `npm run build`.\n\n# History\n\n[see history.md](history.md)\n\n","publish_time":1476308455666,"_cnpm_publish_time":1476308455666,"dist-tags":{"latest":"3.2.2"}}