json-parser
JSON parser to parse JSON object and MAINTAIN comments.
Install
$ npm install json-parser --save
Usage
content
/**
blah
*/
// comment at top
{
// comment for a
/* block comment */
"a": 1 // comment at right
}
// comment at bottom
var parser = require('json-parser');
var object = parser.parse(content);
console.log(object);
And the result will be:
{
'//^': ['/**\n blah\n */', '// comment at top'],
'//$': ['// comment at bottom'],
'// a': [
['// comment for a', '/* block comment */'],
['// comment at right']
],
a: 1
}
License
MIT