Skip to content

parseJsonc

parseJsonc(text, sourceLabel?): unknown

Defined in: _worktrees/docs-release/gaunt-sloth/packages/core/src/config/jsonc.ts:29

Parse a JSONC string (JSON + comments + trailing commas) into a value.

On success returns the parsed value. On a structural error (anything JSON.parse would also reject, e.g. a missing brace or a dangling property) it throws a SyntaxError whose message names the first problem and its 0-based character offset, so the loader’s existing “Failed to read config …” diagnostics stay actionable.

string

The file contents.

string

Optional human-readable source name, included in the error message.

unknown