{"name":"hjson","description":"A user interface for JSON.","main":"./lib/hjson.js","author":{"name":"Christian Zangl"},"version":"3.1.0","keywords":["json","comments","config","hjson","parser","serializer","human"],"bin":{"hjson":"./bin/hjson"},"scripts":{"test":"node ./test/test.js","lint":"node_modules/eslint/bin/eslint.js -f unix bin/hjson lib/*.js","build_v1":"node -e 'console.log(\"module.exports=\\\"\"+eval(\"(\"+process.argv[1]+\")\").version+\"\\\";\");' -- \"`cat package.json`\" > lib/hjson-version.js","build_v2":"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`\"","build_bundle":"node_modules/browserify/bin/cmd.js -p browserify-header --ignore os -s Hjson -o bundle/hjson.js lib/hjson.js","build_min":"node node_modules/uglify-js/bin/uglifyjs bundle/hjson.js --comments=/^!/ -c -m -o bundle/hjson.min.js","build":"npm run build_v1 && npm run build_v2 && npm run test && npm run lint && npm run build_bundle && npm run build_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":{"browserify":"^13.3.0","browserify-header":"0.9.2","eslint":"^3.13.1","uglify-js":"^2.7.5"},"gitHead":"7db87c7a89fe32f0e771452e6d8242b4b8a72d2e","_id":"hjson@3.1.0","_npmVersion":"5.3.0","_nodeVersion":"8.1.4","_npmUser":{"name":"laktak","email":"coralllama@gmail.com"},"dist":{"integrity":"sha512-32Xt9W+25uH3/nKUkAGTrwRj0pbibWUI25pUzM13QPSRMRAHSoXgjQ1NS/tscpZ53h9CwrSy7woAlzJDCydWig==","shasum":"dd468d0a74fe227b79afd85b0df677433a633501","tarball":"http://registry-npm.ywwl.com/hjson/download/hjson-3.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH5zvQK6Ez0XCmIvu3De03aExTvlqSlpwjq/OWHSJHm1AiA/5TSsS50ewTZRG/7cioq3tjxmqI5ENQ8ChEL6BYNwdg=="}],"size":36401,"noattachment":false,"key":"/hjson/-/hjson-3.1.0.tgz"},"maintainers":[{"name":"laktak","email":"coralllama@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hjson-3.1.0.tgz_1500587784154_0.8430668192449957"},"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":1500587785231,"_cnpm_publish_time":1500587785231,"dist-tags":{"latest":"3.2.2"}}