@ende/jsonc

ende add jsr:@ende/jsonc

Version 2026.10.15 on JSR.

Provides tools for working with JSONC (JSON with comments).

Currently, this module only provides a means of parsing JSONC. JSONC serialization is not yet supported.

import { parse } from "@ende/jsonc";
import { assertEquals } from "@ende/assert";

assertEquals(parse('{"foo": "bar", } // comment'), { foo: "bar" });
assertEquals(parse('{"foo": "bar", } /* comment *\/'), { foo: "bar" });

Modules

Exports

  • JsonValue — The type of the result of parsing JSON.
  • parse — Converts a JSON with Comments (JSONC) string into an object.