Skip to content

tolerantParseJson

tolerantParseJson(text): TolerantParse

Defined in: src/json-tolerant.ts:30

Parse text as JSON, tolerating the malformed-but-recoverable cases the unattended verdict spawns produce (unescaped inner quotes, trailing commas, …). Strict JSON.parse is tried first (well-formed input pays zero repair cost and reports repaired: false); on failure the text is run through jsonrepair and re-parsed (repaired: true); if that also fails the input is genuinely irreparable and { status: "unparseable" } is returned.

string

TolerantParse