{"uid":"cap_YXXu08UHTmByQvQ5SydZa","slug":"json-repair-trailing-commas-single-quotes-code-fences-python-literals-9e05f897","name":"JSON Repair (Trailing Commas, Single Quotes, Code Fences, Python Literals)","description":"Repair malformed JSON (trailing commas, single quotes, code fences, Python literals) — Genesis402 / UnyKorn Operator Network","url":"https://twin.unykorn.org/ai/json-repair?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"params":{"type":"object","properties":{"text":{"type":"string","description":"required, up to 20,000 chars"}}}}},"responseSchema":{"type":"json","example":{"ok":true,"type":"json-repair","receipt":{"tx_hash":"0x<64hex>","amount_usd":0.002,"receipt_id":"g402-<16hex>"},"sources":[{"ok":true,"name":"<source>"}],"limitations":"<text>","generated_at":"<iso time>","evidence_hash":"sha256:<64hex>"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_ckMXwI9ioaczziyvsmz3K","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Repairs malformed JSON strings by fixing common syntax errors such as trailing commas, single quotes, code fences, and Python-style literals.","exampleAgentPrompt":"This JSON string from the LLM response has trailing commas and single quotes instead of double quotes — can you fix it so it parses correctly? Here it is: {'name': 'Alice', 'age': 30,}","exampleUseCases":[{"title":"Fix LLM-generated JSON output","prompt":"The AI returned JSON wrapped in markdown code fences with single quotes and a trailing comma — can you repair it into valid, parseable JSON? Here's the raw output: ```{'user': 'Bob', 'score': 42,}```"},{"title":"Repair Python dict from script","prompt":"I have a Python dictionary that got dumped as a string but I need it as proper JSON — can you convert it? Here it is: {'items': ['apple', 'banana',], 'count': 2, 'active': True}"},{"title":"Clean up API response with syntax errors","prompt":"This JSON I got back from a third-party tool won't parse because it has trailing commas and uses None instead of null — please fix it so I can use it: {\"results\": [1, 2, 3,], \"error\": None}"}],"resultDescription":"Returns a syntactically valid, parseable JSON string with all common malformation issues resolved, including trailing commas removed, single quotes converted to double quotes, code fences stripped, and Python literals (True, False, None) converted to their JSON equivalents.","failureModes":["Input text exceeds 20,000 character limit — request rejected","Input is so severely malformed that valid JSON cannot be inferred — may return error or best-effort result","Non-JSON input (e.g. plain prose) may produce unexpected output","Network or payment failure via x402 protocol"],"whenToPreferThis":"Use this endpoint when you need to programmatically fix malformed JSON produced by LLMs, scrapers, or legacy systems that emit trailing commas, single-quoted strings, Python-style literals (True/False/None), or markdown code fences. Prefer this over manual regex fixes when the malformation pattern is varied or unknown.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-01T18:13:14.296Z","isFirstParty":false,"canonicalSlug":"json-repair-trailing-commas-single-quotes-code-fences-python-literals-9e05f897"}