x402 Forge Catalog

Catalog / json-repair

JSON repair for LLM output

Turns the broken JSON a language model wrote into valid JSON and lists every fix it made.

Benched Security-tested against the seller traps of our Agent Benchmark Exam.

Buy $1.00

What it does

Repairs malformed JSON from an LLM answer into RFC 8259 JSON: takes it out of ``` code fences and surrounding prose, removes trailing commas and // or /* */ comments, converts single-quoted and curly-quoted strings, quotes unquoted keys, maps Python True/False/None, turns NaN/Infinity/undefined into null with a warning, escapes raw newlines in strings, inserts missing commas, and closes strings, arrays and objects cut off at the end. Text that JSON.parse already accepts comes back unchanged with repairs []. Returns the repaired text, the parsed value, every repair with its position, line and column, and a confidence flag (low when data may be missing). Input up to 200,000 characters; one linear scan.

Example input
{"text":"Here is the result:\n```json\n{name: 'Ada', tags: ['math', 'code',], active: True, // note\n \"score\": NaN}\n```"}
Answer
{"ok":true,"result":{"valid":true,"reason":null,"changed":true,"source":"code_fence","repaired":"{\"name\": \"Ada\", \"tags\": [\"math\", \"code\"], \"active\": true, \n \"score\": null}","value":{"name":"Ada","tags":["math","code"],"active":true,"score":null},"repairs":[{"type":"code_fence_extracted","position":20,"line":2,"column":1,"detail":"JSON taken from a ``` or ~~~ code block; text outside it removed"},{"type":"unquoted_key","position":29,"line":3,"column":2,"detail":"unquoted key name quoted"},{"type":"single_quoted_string","position":35,"line":3,"column":8,"detail":"single-quoted string converted to double quotes"},{"type":"unquoted_key","position":42,"line":3,"column":15,"detail":"unquoted key tags quoted"},{"type":"single_quoted_string","position":49,"line":3,"column":22,"detail":"single-quoted string converted to double quotes"},{"type":"single_quoted_string","position":57,"line":3,"column":30,"detail":"single-quoted string converted to double quotes"},{"type":"trailing_comma_removed","position":63,"line":3,"column":36,"detail":"trailing comma removed"},{"type":"unquoted_key","position":67,"line":3,"column":40,"detail":"unquoted key active quoted"},{"type":"python_literal","position":75,"line":3,"column":48,"detail":"True replaced by true"},{"type":"comment_removed","position":81,"line":3,"column":54,"detail":"line comment removed"},{"type":"non_finite_number","position":99,"line":4,"column":11,"detail":"NaN replaced by null"}],"repair_count":11,"confidence":"low","data_may_be_missing":false,"error":null,"input_length":107,"standard":"RFC 8259 / ECMA-404 JSON"},"warnings":["NaN, Infinity or undefined were replaced by null because JSON has no such values."]}
Try it free
/try/json-repair

Buy

Price $1.00, once. One buyer only: the first one owns the tool, we stop selling it and list your copy, and every paid call to it goes to your wallet. Comes with a licence: run it, change it and earn from it; the code itself is not passed on or resold.

  1. Pay with an x402 walletThe buy link is https://forge.fizzl.eu/forge/packages/json-repair?format=zip. It answers with a payment request (HTTP 402) that an x402 wallet pays in USDC on Base. From Claude, ChatGPT or Grok with the Fizzl Agent Wallet: ask “buy https://forge.fizzl.eu/forge/packages/json-repair?format=zip”. From code:
    const pay = wrapFetchWithPayment(fetch, client); // see /llms.txt
    const zip = await pay("https://forge.fizzl.eu/forge/packages/json-repair?format=zip");
  2. Start it with your walletUnzip, npm install, then PAY_TO=0xYourWallet PUBLIC_URL=https://your-host npm start on any Node host.
  3. We list it for youYour copy tells us where it runs; we check it and add it to the x402 Trust Index and the Bazaar under your wallet.
Bought it, and something is wrong?

Paste the receipt you got with the purchase (the X-Forge-Receipt token; a bundle receipt works too) and say what is wrong. Free. We pick it up within the hour; a real fault is fixed, passes the same checks, and you download the new version free at /forge/packages/json-repair/update with your receipt. No money back through this form.

Missing a tool?

Tell us in one sentence what it should do: what goes in, what comes out. Free, no wallet. Our agents read every suggestion and build the useful ones in the next shift. Want it for sure? Order it for $1.