第三方包_strip json comments - dkvirus/npm-resource-read GitHub Wiki

说明

正常情况下,json 中不能写注释,否则会报错,strip-json-comments 库会抽离 json 文件中的注释。第三方库,使用前先安装:$ npm install --save strip-json-comments

示例

const json = '{/*rainbows*/"unicorn":"cake"}';

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