You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Rich Trott e8a7003e94 tools: update ESLint, fix unused vars bug 9 years ago
..
cli.js tools: update eslint to v1.10.3 9 years ago
license tools: update eslint to v1.10.3 9 years ago
package.json tools: update ESLint, fix unused vars bug 9 years ago
readme.md tools: update eslint to v1.10.3 9 years ago
strip-json-comments.js tools: update eslint to v1.10.3 9 years ago

readme.md

strip-json-comments Build Status

Strip comments from JSON. Lets you use comments in your JSON files!

This is now possible:

{
	// rainbows
	"unicorn": /* ❤ */ "cake"
}

It will remove single-line comments // and multi-line comments /**/.

Also available as a gulp/grunt/broccoli plugin.

There's also json-comments, but it's only for Node.js, inefficient, bloated as it also minifies, and comes with a require hook, which is :(

Install

$ npm install --save strip-json-comments
$ bower install --save strip-json-comments
$ component install sindresorhus/strip-json-comments

Usage

var json = '{/*rainbows*/"unicorn":"cake"}';
JSON.parse(stripJsonComments(json));
//=> {unicorn: 'cake'}

API

stripJsonComments(input)

input

Type: string

Accepts a string with JSON and returns a string without comments.

CLI

$ npm install --global strip-json-comments
$ strip-json-comments --help

strip-json-comments input-file > output-file
# or
strip-json-comments < input-file > output-file

License

MIT © Sindre Sorhus