{"uid":"cap_RgS97XGDJX58X_WeSo3uS","slug":"json-repair-parse-for-llm-output-d3df4f2b","name":"JSON Repair & Parse for LLM Output","description":"Deterministically repair malformed JSON from LLM output - fixes trailing commas, single quotes, unquoted keys, markdown fences, comments and Python literals, returning parsed data. json repair, fix json, parse llm json, broken json, json fixer, malformed json","url":"https://api.x402node.dev/ai/json-repair","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"json":{"type":"string","description":"The broken JSON string to repair (required, max 500KB)"},"text":{"type":"string","description":"Input text (optional)"},"input":{"type":"string","description":"Input (optional)"}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.006","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.006/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.006","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.006","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_0O18Hxwyvv2f0BeLCLaRa","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.006","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Deterministically repairs and parses malformed JSON from LLM output, fixing trailing commas, single quotes, unquoted keys, markdown fences, comments, and Python literals","exampleAgentPrompt":"The JSON I got back from the LLM has trailing commas, markdown fences, and single quotes — can you repair and parse it into valid structured data? Here's the broken string: ```json {'name': 'Alice', 'scores': [1, 2, 3,],}```","exampleUseCases":null,"resultDescription":"Returns the repaired and fully parsed JSON as structured data (object or array), ready for programmatic consumption — no longer a raw string, but an actual parsed result with all syntax errors resolved","failureModes":["Input is so malformed it cannot be salvaged into any valid JSON structure — returns error indicating unrecoverable input","Input is not JSON-like at all (e.g. plain prose with no JSON tokens) — may return error or unexpected result","Ambiguous repair heuristics may occasionally produce a different valid structure than intended when multiple repair paths exist","Payment failure or insufficient USDC balance results in 402 response before any processing occurs"],"whenToPreferThis":"Use this endpoint when handling LLM-generated JSON that frequently contains common syntax errors like trailing commas, single-quoted strings, unquoted keys, embedded markdown code fences, JavaScript comments, or Python-style literals (True/False/None). It is especially suited for production pipelines that consume raw LLM output and need reliable, deterministic parsing without writing custom sanitization logic. Prefer it over manual regex cleaning or ad-hoc parsers when you need a robust, maintained repair solution.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T13:09:51.212Z","isFirstParty":false}