-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
42 lines (42 loc) · 6.26 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{
"name": "json5",
"version": "0.1.0",
"description": "JSON for the ES5 era.",
"keywords": [
"json",
"es5"
],
"author": {
"name": "Aseem Kishore",
"email": "aseem.kishore@gmail.com"
},
"contributors": [
{
"name": "Max Nanasy",
"email": "max.nanasy@gmail.com"
}
],
"main": "lib/json5.js",
"bin": {
"json5": "lib/cli.js"
},
"dependencies": {},
"devDependencies": {
"mocha": "~1.0.3"
},
"scripts": {
"test": "mocha --ui exports --reporter spec"
},
"homepage": "http://json5.org/",
"repository": {
"type": "git",
"url": "https://github.com/aseemk/json5.git"
},
"readme": "# JSON5 – Modern JSON\n\nJSON isn't the friendliest to write and maintain by hand. Keys need to be\nquoted; objects and arrays can't have trailing commas; comments aren't\nsupported — even though none of these is the case with regular JavaScript\ntoday.\n\nRestricting JSON to such a strict subset of \"JavaScript object notation\" made\nsense for making it a great data-exchange format, but JSON's usage has\nexpanded [beyond][ex1] [machine-to-machine][ex2] [communication][ex3].\n\n[ex1]: http://plovr.com/docs.html\n[ex2]: http://npmjs.org/doc/json.html\n[ex3]: http://code.google.com/p/fuzztester/wiki/JSONFileFormat\n\n**JSON5 is a proposed extension to JSON** that brings ES5 enhancements to its\nsyntax. It remains a **strict subset of JavaScript**, adds **no new data\ntypes**, and is a **strict superset of existing JSON**.\n\nJSON5 is not an official successor to JSON, and existing JSON parsers may not\nunderstand these new features. It's thus recommended that files use a new\nextension like `.json5` to be explicit. *[TODO: New MIME type too?]*\n\nThis module provides a JavaScript implementation that works on all modern JS\nengines (even IE6). Its parser is based directly off of Douglas Crockford's\neval-free [json_parse.js][], making it both secure and robust. Give it a try!\n\n## Features\n\nThese are the new features of JSON5's syntax. All of these are optional, and\nall of these are part of ES5 JavaScript.\n\n- Object keys don't need to be quoted if they're valid [identifiers](\n https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Core_Language_Features#Variables). Yes, even reserved keywords are valid unquoted keys in ES5 [[§11.1.5](http://es5.github.com/#x11.1.5), [§7.6](http://es5.github.com/#x7.6)].\n *[TODO: Unicode characters and escape sequences aren't yet supported in this implementation.]*\n\n- Strings can be single-quoted.\n\n- Strings can be split across multiple lines; just prefix each newline with a\n backslash. [ES5 [§7.8.4](http://es5.github.com/#x7.8.4)]\n\n- Objects and arrays can have trailing commas.\n\n- Both inline (single-line) and block (multi-line) comments are allowed.\n\n- Numbers can be hexadecimal (base 16), and they can also begin with a leading\n decimal (e.g. `.5`).\n\n## Example\n\n```js\n{\n foo: 'bar',\n while: true,\n \n this: 'is a\\\n multi-line string',\n \n // this is an inline comment\n here: 'is another', // inline comment\n \n /* this is a block comment\n that continues on another line */\n\n hex: 0xDEADbeef,\n half: .5,\n \n finally: 'a trailing comma',\n oh: [\n \"we shouldn't forget\",\n 'arrays can have',\n 'trailing commas too',\n ],\n}\n```\n\n## Installation\n\nVia npm on Node:\n\n```\nnpm install json5\n```\n\n```js\nvar JSON5 = require('json5');\n```\n\nOr in the browser (adds the `JSON5` object to the global namespace):\n\n```html\n<script src=\"json5.js\"></script>\n```\n\n## Usage\n\n```js\nvar obj = JSON5.parse('{unquoted:\"key\",trailing:\"comma\",}');\nvar str = JSON5.stringify(obj);\nconsole.log(obj);\nconsole.log(str);\n```\n\n`JSON5.stringify()` is currently aliased to the native `JSON.stringify()` in\norder for the output to be fully compatible with all JSON parsers today.\n\nIf you're running Node, you can also register a JSON5 `require()` hook to let\nyou `require()` `.json5` files just like you can `.json` files:\n\n```js\nrequire('json5/lib/require');\nrequire('./path/to/foo'); // tries foo.json5 after foo.js, foo.json, etc.\nrequire('./path/to/bar.json5');\n```\n\nThis module also provides a `json5` executable (requires Node) for converting\nJSON5 files to sibling JSON files:\n\n```\n$ json5 -c path/to/foo.json5 # generates path/to/foo.json\n```\n\n## Development\n\n```\ngit clone git://github.com/aseemk/json5.git\ncd json5\nmake\nmake test\n```\n\nIf your system doesn't have Make, this should work in place of `make [test]`:\n\n```\n./lib/cli.js -c package.json5\nnpm install\nnpm test\n```\n\nMake is used to auto-generate the package.json file that npm requires from our\npackage.json5 file. Just re-run `make` (or `./lib/cli.js -c package.json5`) on\nchanges to package.json5.\n\nFeel free to [file issues](https://github.com/aseemk/json5/issues) and submit\n[pull requests](https://github.com/aseemk/json5/pulls) — contributions are\nwelcome.\n\nIf you submit a pull request, please be sure to add or update corresponding\ntest cases, and ensure that `make test` (or `npm test`) continues to pass.\n\n## License\n\nMIT License. © 2012 Aseem Kishore, and [others](\nhttps://github.com/aseemk/json5/contributors).\n\n## Credits\n\n[Michael Bolin](http://bolinfest.com/) independently arrived at and published\nsome of these same ideas with awesome explanations and detail.\nRecommended reading:\n[Suggested Improvements to JSON](http://bolinfest.com/essays/json.html)\n\n[Douglas Crockford](http://www.crockford.com/) of course designed and built\nJSON, but his state machine diagrams on the [JSON website](http://json.org/),\nas cheesy as it may sound, gave me motivation and confidence that building a\nnew parser to implement these ideas this was within my reach!\nThis code is also modeled directly off of Doug's open-source [json_parse.js][]\nparser. I'm super grateful for that clean and well-documented code.\n\n[json_parse.js]: https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js\n\n[Max Nanasy](https://github.com/MaxNanasy) has been an early and prolific\nsupporter, contributing multiple patches and ideas. Thanks Max!\n",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/aseemk/json5/issues"
},
"_id": "json5@0.1.0",
"_from": "json5@0.1.x"
}