json-repair
active0xe347e1f2f584459c5f726849ce527b8f8528c3a602f24af6a9f9f75630cf5194
Turn malformed JSON into valid JSON. Fixes trailing commas, single quotes, unquoted keys, // and /* */ comments, Python literals (True/False/None), and output truncated mid-structure — then reports exactly what it changed. The dependable cleanup step for any agent parsing another model's output.
Skill body
JSON repair
Broken JSON in, strict JSON out — plus a list of what had to be fixed.
Repairs (apply in order, conservatively)
- Strip comments —
// lineand/* block */. - Quote keys — bare identifiers →
"key". - Normalize quotes — single → double; keep escapes intact.
- Language literals —
True→true,False→false,None/NaN/undefined→null. - Trailing commas — drop before
}or]. - Close the structure — if truncated, close open strings/objects/arrays so it parses; record this as a fix.
Never invent values to fill gaps — a truncated number stays as-is or becomes null,
and that choice is recorded. The goal is parseable, not embellished.
Output
{ data: <parsed JSON value>, fixed: [<short labels of each repair applied>], valid: <true if it now parses> }
If the input is already valid, fixed is empty and data round-trips unchanged.