Package Exports
- jsonc-parse
Readme
jsonc-parse
A lightweight JSON with Comments parser.
Install
npm install jsonc-parse
Usage
import { parse, parseFile, parseFileSync } from "jsonc-parse";
// From file async
const jsonCFile = await parseFile("./config.jsonc");
// From file
const jsonCFile = parseFileSync("./config.jsonc");
// From string
const jsonC = parse(`
{
"bar": "foo",
// This is a comment.
"foo": /* This is also a comment */ "bar",
}`);