require-strip-json-comments
Require .json files with comments.
For advanced JSON syntax I recomend using require-json5, which can load JSON with trailing commas, unquoted keys, hex numbers, comments, and more.
Install
npm i require-strip-json-comments
Usage
- Load a JSON file which contains comments
var requireJSON = ;var config = ;
- Parse a JSON string which contains comments
var requireJSON = ;var config = requireJSON;
- Replace
require()
;var config = ;
- Replace
JSON.parse()
;var config = JSON;
- Replace
require()
andJSON.parse()
;// ...