JSON repair API
Fix broken JSON from LLMs and scrapers
Send the almost-JSON your model or scraper produced and get valid, parseable JSON back — no fragile regex cleanup in your app.
The problem
LLM output and scraped payloads are constantly almost-JSON: trailing commas, single quotes, unquoted keys, a stray markdown fence. JSON.parse throws, and hand-rolled cleanup breaks on the next edge case you didn't anticipate.
What you get
- Repairs the common failure modes — trailing commas, single quotes, unquoted keys
- Returns valid JSON you can parse directly
- Purpose-built for LLM and scraper output, not just pretty-printing
- One call instead of a growing pile of string replacements
Call it in one request
Plain HTTPS and JSON against /api/v1/json-repair. Use the SDK for typed calls, or hit the endpoint directly — same contract either way.
cURL
curl https://zapinner.com/api/v1/json-repair \
-H "Authorization: Bearer zap_live_••••••" \
-H "Content-Type: application/json" \
-d '{"input":"{'a':1, b:2,}"}'JavaScript (fetch)
const res = await fetch("https://zapinner.com/api/v1/json-repair", {
method: "POST",
headers: {
Authorization: "Bearer zap_live_••••••",
"Content-Type": "application/json",
},
body: JSON.stringify({
"input": "{'a':1, b:2,}"
}),
})
const data = await res.json()@zapinner/sdk
import { Zapinner } from "@zapinner/sdk"
const zap = new Zapinner({ apiKey: process.env.ZAPINNER_API_KEY })
const result = await zap.jsonRepair({
"input": "{'a':1, b:2,}"
})Frequently asked
- What kinds of breakage can it fix?
- The everyday malformations that make JSON.parse fail — trailing commas, single-quoted strings, unquoted keys, and similar near-miss syntax from model and scraper output.
- Is it a good fit for LLM responses?
- Yes — it's built for exactly the almost-JSON that language models emit, so you can repair and parse in one step instead of prompting for retries.
- What if the input is unrecoverable?
- If the payload can't be made into valid JSON, the response says so clearly rather than returning silently-wrong output.
Related solutions
Ship it today with Zapinner
One API key, one consistent interface, 79 data capabilities. Start on the free plan — no credit card required.
