Developer tools

JSON repair and validator for AI output

Fix the JSON a language model gives you: trailing commas, single quotes, comments, code fences, cut-off text and more.

JSON repair and validator for AI output
Esc to restore

Your inputs

Paste a model’s answer, with or without surrounding text. Up to 2 MB.

Results update as you type. Larger files run when you press Update result.

Your result

Your result will appear here.

More actions

Your inputs stay in this browser. Nothing is uploaded or saved.

A clear answer. Here’s how.

A tolerant reader walks the text and builds the JSON it most plausibly describes, recording every change. It takes JSON out of a Markdown code fence or from between sentences; removes // and /* */ comments and extra or trailing commas; turns single, curly and backtick quotes into double quotes; quotes bare keys and bare words; changes True, False, None and undefined; converts hex numbers and strips plus signs and leading zeros; escapes line breaks inside strings and keeps quotation marks that sit inside text; adds missing commas, colons and null values; removes “…” placeholders; and closes brackets and strings when the text is cut off. The result is written with exact number text and checked with a strict JSON parser. Every repair is a guess, so the list of changes tells you where to look.

How this is checked

5 reference checks passed These 5 cases were run when this page was built, on 20 October 2026, and all reproduce within the stated tolerance. The same cases are part of the automated tests that run on every change to Toolmoz. Engine version 1.

See the checks and where each expected answer comes from
  1. Case 1

    Inputs
    Text containing JSON ```json {"name": "Ann", "age": 30,} ```Indent 2
    Expected, and what Toolmoz gave
    text expected { "name": "Ann", "age": 30 } , Toolmoz { "name": "Ann", "age": 30 } Repairs applied expected 2, Toolmoz 2Valid JSON now expected Yes, Toolmoz Yes
    Where the expected answer comes from
    RFC 8259 grammar: two repairs, the code fence and the trailing comma, give the object {"name":"Ann","age":30}
    Allowed difference
    exact
  2. Case 2

    Inputs
    Text containing JSON {'a': 1, b: True, c: None}Indent 0
    Expected, and what Toolmoz gave
    text expected {"a":1,"b":true,"c":null} , Toolmoz {"a":1,"b":true,"c":null} Repairs applied expected 5, Toolmoz 5
    Where the expected answer comes from
    Five changes by hand: the single-quoted key a, the bare keys b and c, True and None
    Allowed difference
    exact
  3. Case 3

    Inputs
    Text containing JSON {"items": [1, 2, {"id": 3Indent 0
    Expected, and what Toolmoz gave
    text expected {"items":[1,2,{"id":3}]} , Toolmoz {"items":[1,2,{"id":3}]} Output looks cut off expected Yes: values at the end may be missing, Toolmoz Yes: values at the end may be missing
    Where the expected answer comes from
    The text ends inside an object inside an array inside an object, which are closed in turn
    Allowed difference
    exact
  4. Case 4

    Inputs
    Text containing JSON Sure! Here is the data: {"ok": true, "n": 1} Let me know if you need more.Indent 0
    Expected, and what Toolmoz gave
    text expected {"ok":true,"n":1} , Toolmoz {"ok":true,"n":1} Repairs applied expected 2, Toolmoz 2
    Where the expected answer comes from
    The sentence before the object and the sentence after it are removed
    Allowed difference
    exact
  5. Case 5

    Inputs
    Text containing JSON {"a": 1, "b": [true, null]}Indent 0
    Expected, and what Toolmoz gave
    text expected {"a":1,"b":[true,null]} , Toolmoz {"a":1,"b":[true,null]} Repairs applied expected 0, Toolmoz 0
    Where the expected answer comes from
    Valid JSON is only reformatted
    Allowed difference
    exact

What this shows: the engine reproduces independently worked values for these cases. It does not prove every possible input is right. To test an answer you were given, see how to check a number; to see what is and is not checked across Toolmoz, see the accuracy ledger.

See a worked example

Worked example

A fixed demonstration, separate from the values you enter above.

Text containing JSON
```json
{
  name: 'Ada',
  "tags": ["maths", "code",],
  // note
  "active": True,
  "score": 9.5
}
```
Indent
2 spaces

Example result

Repairs applied
6
Valid JSON now
Yes
Top-level value
object
Top-level items
4
Output looks cut off
No

Repairs: 2:1 Took the JSON out of a Markdown code fence • 3:3 Put the key name in quotes • 3:9 Changed single quotes to double quotes • 4:27 Removed a trailing comma • 5:3 Removed a // comment • 6:13 Changed True to true. Each repair is a guess about what was meant, so check the result before relying on it. The output is checked with a strict JSON parser. Numbers are kept as written, repeated keys are kept, and nothing is sent anywhere.