parse
import { parse } from "jsr:@ende/jsonc";function
function parse(text: string): JsonValueConverts a JSON with Comments (JSONC) string into an object.
text: stringA valid JSONC string.
Returns
The parsed JsonValue from the JSONC string.
Example: Usage
import { parse } from "@ende/jsonc";
import { assertEquals } from "@ende/assert";
assertEquals(parse('{"foo": "bar"}'), { foo: "bar" });
assertEquals(parse('{"foo": "bar", }'), { foo: "bar" });
assertEquals(parse('{"foo": "bar", } /* comment *\/'), { foo: "bar" });