Package Exports
- comment-json
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (comment-json) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
comment-json

Parse and stringify JSON file with domments.
Install
$ npm install comment-json --saveUsage
package.json:
{
// package name
"name": "comment-json"
}var json = require('comment-json');
var obj = json.parse(fs.readFileSync('package.json').toString());
console.log(obj);
// ->
// {
// "// name": "// package name",
// name: "comment-json"
// }
json.stringify(obj, null, 2); // Will be the same as package.jsonjson.parse(string, [reviver])
The arguments are the same as the vanilla JSON.parse.
json.stringify(object, [replacer], [space])
The arguments are the same as the vanilla JSON.stringify.
And it does the similar thing as the vanilla one, and also stringify the "// abc"-like property into comments if the "abc" property is found.
#<!-- ## json.strip(string)
Strips comments from string.
json.clean(object)
Clean comment properties.
var object = {
"// name": "// package name",
name: "comment-json"
};
json.clean(object); // {name: "comment-json"}
``` -->
## License
MIT