Package Exports
- void-jsonc
- void-jsonc/jsonc-parser.js
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 (void-jsonc) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
void-jsonc
Standalone Javascript JSONC/CSON parser.
how does it work?
void-jsonc remove comments from the jsonc data and use a json parser to turn it into a JSON Object.
void-jsonc does not let you write jsonc files.
how to use it?
// or const { parse } = require('void-jsonc');
const JSONC = require('void-jsonc');
JSONC.parse('path/to/test.jsonc');
can i use a different json parser?
absolutely! you can make this use any parser
// either have a function like this or use the parser directly
let parser = (jsonString) => {
return MyParser(jsonString)
}
// use `JSON.parse` by default
JSONC.parse('path/to/test.jsonc');
// use a custom function to parse json
JSONC.parse('path/to/test.jsonc', parser);
// use your parser directly
JSONC.parse('path/to/test.jsonc', MyParser);