← All Tools

🩹 JSON Repair

Repair malformed JSON locally with an auditable change log.

Context Workbench: repair malformed JSON before querying or shrinking it.

BROWSER-LOCAL · EXPLICIT RUN

Repair structured output, then inspect every change

Start with malformed JSON, repair it locally, and optionally validate the canonical value against a submitted schema or validate a separate tool definition or call. Nothing runs when this page or a preset loads.

Submitted schema (optional)

Use the published bounded JSON Schema subset. Missing values and type conversions are never invented.

Tool definition or call (optional)

Submit exactly {"mode":"openai-call","input":{...}}. This validates the submitted fixture; it never executes a tool.

Nothing has run. Review the input, then repair explicitly.

Copy or download this exact generation

Every artifact comes from the same canonical request and result. Exports are inert until you submit them yourself.

WORKED EXAMPLES

What the separate stages reveal

Trailing comma and unquoted keys

{name:"Ada",items:[1,2,],}

The repair list identifies each syntax edit; canonical output sorts object keys without claiming semantic correctness.

Schema mismatch stays visible

Output: {"count":"2"}
Schema: count must be integer

The source value remains a string. Schema diagnostics report the exact path rather than coercing it.

Tool-call arguments stay separate

{"mode":"openai-call","input":{"function":{"name":"save","arguments":"{"}}}

Tool-call diagnostics are separate from syntax and schema findings, and no submitted tool is executed.

Runs in your browser

JSON stays in this browser; nothing runs until an explicit click, and inferred truncation is review-required.

What this tool does

JSON Repair fixes common malformed JSON and records each deterministic change.

Why it is useful

It avoids model retry loops while keeping inferred closures visible and review-required.

Supported repairs

Fences, leading prose, comments, unquoted keys, single quotes, trailing commas, and explicit opt-in truncated closures.

Separate validation

Optional submitted-schema and tool-call checks publish their own diagnostics without inventing or coercing values.

Privacy note

Repair and validation run locally in your browser only after you click Repair JSON locally.

Important limitation

Inferred closures require explicit opt-in and review. Deterministic syntax repair does not prove semantic correctness.

Related Tools

🧰Context Workbench🎯JSON Query🗜️JSON Shrink🧠Prompt Optimizer🧩Few-shot Example GeneratorTool Calling Validator
View all in AI →