void-jsonc
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

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);

Package Sidebar

Install

npm i void-jsonc

Weekly Downloads

2

Version

0.0.2

License

MIT

Unpacked Size

3.35 kB

Total Files

7

Last publish

Collaborators

  • mrthomas20121