Converts a JSON with Comments (JSONC) string into an object.
A valid JSONC string.
The parsed JsonValue from the JSONC string.
import { parse } from "@std/jsonc";import { assertEquals } from "@std/assert";assertEquals(parse('{"foo": "bar"}'), { foo: "bar" });assertEquals(parse('{"foo": "bar", }'), { foo: "bar" });assertEquals(parse('{"foo": "bar", } /* comment */'), { foo: "bar" }); Copy
import { parse } from "@std/jsonc";import { assertEquals } from "@std/assert";assertEquals(parse('{"foo": "bar"}'), { foo: "bar" });assertEquals(parse('{"foo": "bar", }'), { foo: "bar" });assertEquals(parse('{"foo": "bar", } /* comment */'), { foo: "bar" });
If the JSONC string is invalid.
Converts a JSON with Comments (JSONC) string into an object.