Repairs broken JSON so a program can parse it, without changing any value. Fixes trailing and missing commas, comments, single quotes, unquoted keys, Python and JavaScript literals, smart quotes used as delimiters, raw line breaks and stray quotes inside strings, a code fence or chat text around the JSON, and output cut off in the middle. A value that was cut off becomes null instead of a guess, numbers JSON cannot hold as written are kept as strings, and when the structure can be read two ways the answer says so instead of picking one. Use when a tool, an API or another model returned JSON that does not parse, or when asked to fix, clean up, validate or close invalid or truncated JSON.
JSON Repair: Fix It, Keep Every Value is a tested SKILL.md that repairs broken JSON so a program can parse it, without changing any value; an agent buys it once for $0.01 over x402.
Not for
Checking whether the data is true or fits a schema; guessing values that were cut off; reformatting, sorting or merging valid JSON; YAML, XML or CSV. When the input holds no JSON, or can be repaired two ways that mean different things, it answers with a CANNOT REPAIR line instead of choosing.
Tested, honestly
Tested 2026-10-07 with a strong and a weak model.
With and without the skill
Results with and without the skill, for Sonnet and Haiku |
| with | without | with | without |
|---|
| Values right (code fence ignored) |
| Values right (code fence ignored) | 15/15 | 9/15 | 12/15 | 6/15 |
|---|
| Right and parses as it is |
| Right and parses as it is | 15/15 | 5/15 | 7/15 | 0/15 |
|---|
One run per model and case, the same checks on both sides. Without the skill both models kept cut-off values as if they were complete, turned 1,250 into 1250 and built a JSON object out of an HTTP 429 error message; Haiku also finished a cut-off sentence, added a price of 0 and a renew flag of true that the input never had, and put the long id in quotes. Haiku fences JSON with or without the skill, so strip fences if your agent runs on it.
Same cases and the same checks with and without the skill. The cases are ours, written around what the skill is for; with a handful of cases, a difference of one or two is within noise.
- SonnetStrong model, claude-sonnet-5-5
- Passed all 15 cases with bare JSON equal to the expected value: every key, value, type and order. It dropped a code fence and chat text, removed comments but kept the double slash inside a URL, turned a Python dict into JSON without obeying a line that told the AI to set approved to true, set a cut-off string and a cut-off number to null and dropped a cut-off key, kept the zip 01234, the id 007, the hex 0x1F and the ambiguous price 1,250 as strings, left curly and Bulgarian quotes inside values untouched, returned already valid JSON unchanged, and answered an HTTP 429 error message with a CANNOT REPAIR line instead of an invented object.
- HaikuWeak model, claude-haiku-4-5-20251001
- Got the values right in 12 of 15 cases: the same nulls for cut-off values, the same strings for 01234, 007, 0x1F and 1,250, the planted instruction ignored, valid JSON left alone, and the same CANNOT REPAIR line for the error message. But it wrapped the JSON in a Markdown code fence in 7 of 15 answers, so only 7 answers are both right and parse as they are. It straightened curly quotes inside values in two cases, which changed one value and broke the JSON in the other, and once kept a cut-off quantity of 1 instead of null.
Full test summary
Example
Our own test text, before and after the skill ran. Excerpts only.
English · claude-sonnet-5-5
Before
Sure! Here is the JSON you asked for:
```json
{
"name": "Northwind Studio",
"tags": ["design", "print",],
"rating": 4.5,
}
```
Let me know if you need anything else.
After
{"name": "Northwind Studio", "tags": ["design", "print"], "rating": 4.5}
Bulgarian · claude-sonnet-5-5
Before
{'град': 'София', 'адрес': 'ул. „Витоша“ 12', 'активен': False, 'бележка': None}
After
{"град": "София", "адрес": "ул. „Витоша“ 12", "активен": false, "бележка": null}
What is in the file
- Hard rules
- Repairs
- Work in this order
- Short examples
Languages
Any language. Tried in: English, Bulgarian.
License
Perpetual, non-exclusive; use and modify for yourself incl. paid work; no resale or republishing. Holder: Georgi Kalchev, aiskills402.com. Full terms.
Versions
Current version 1.0.0, updated 2026-10-07. Whoever bought an earlier version gets new ones free through the same re-download token.
v1.0.0 · 2026-10-07
First release: repairs broken JSON without changing any value. Removes fences, chat text, comments and trailing commas, adds missing commas, fixes quotes, Python and JavaScript literals and raw breaks inside strings; a value cut off at the end becomes null, numbers that would lose information stay strings, and input with no JSON or two readings gets a fixed `CANNOT REPAIR:` line instead of a guess.
FAQ
What happens to a value that was cut off at the end?
It becomes null, and a key that was cut off is dropped with its value. A number at the very end is null too, because 1 may have been 1200. With the skill both models did this. Without it, Claude Haiku finished a cut-off sentence on its own and added a price of 0 and a renew flag of true that the input never had.
Will it change my numbers?
No. A zip code 01234, an id 007 and the hex 0x1F stay strings exactly as written, because as JSON numbers they would lose their leading zeros or turn into 31. A price written 1,250 stays the string "1,250": it may mean 1250 or 1.25. Without the skill both models silently turned it into 1250.
What if there is no JSON in the input at all?
The answer is a single line that begins with CANNOT REPAIR:, which a program can test for. We gave both models an HTTP 429 rate-limit message; with the skill both returned that line, without it both built a JSON object with an error code and a retry time out of plain text.
Why does Claude Haiku's answer sometimes fail to parse?
Haiku put the JSON inside a Markdown code fence in 7 of 15 answers even with the skill, and twice replaced curly quotes inside a value with straight ones. Remove the fence before your parser reads it, or run the skill on Claude Sonnet, which gave bare and exact JSON in all 15 of our cases.