JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2309
  • Score
    100M100P100Q112553F
  • License MIT

A lightweight JSON with Comments parser.

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",
}`);