{"uid":"cap_MBD6LFGsWiRGRI-FF9Sjv","slug":"preflight-agentdiet-dev-deterministic-a2a-broken-json-repair-schema-a88bfe5c","name":"Deterministic A2A Broken-JSON Repair & Schema Validator","description":"Repairs truncated or malformed LLM JSON outputs (trailing commas, markdown fences, single quotes) so multi-agent pipelines never crash. (Live x402 v2, IETF MPP & MCP endpoint at https://preflight.agentdiet.dev/v1/repair)","url":"https://preflight.agentdiet.dev/v1/repair?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","required":["raw_json"],"properties":{"raw_json":{"type":"string","minLength":1,"description":"Malformed, truncated, or markdown-wrapped JSON string to deterministically repair"}}},"responseSchema":{"type":"object"},"example":null,"exampleRequest":null,"tags":[],"displayCostAmount":"0.002","displayCostAsset":"USD","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":"mpp","network":"tempo","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"mpp","network":"tempo","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_vjbokiZlF3eQej4_PmnFQ","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":"preflight.agentdiet.dev","brandSlug":"preflight-agentdiet-dev-mpp","brandBaseUrl":"https://preflight.agentdiet.dev","brandDocsUrl":null,"whatItDoes":"Repairs truncated or malformed LLM JSON outputs (trailing commas, markdown fences, single quotes) so multi-agent pipelines never crash","exampleAgentPrompt":"This JSON response from the LLM is broken — it has trailing commas and markdown code fences wrapped around it. Can you repair it so it's valid JSON I can actually use? Here it is: ```json {\"name\": \"Alice\", \"score\": 42, } ```","exampleUseCases":[{"title":"LLM pipeline JSON crash prevention","prompt":"The structured output from my language model came back with single quotes instead of double quotes and some trailing commas — it keeps crashing my pipeline. Can you fix this JSON so it's valid and parseable: {'user': 'bob', 'items': ['a', 'b',],}"},{"title":"Markdown-fenced agent response cleanup","prompt":"My agent returned a JSON blob wrapped in triple-backtick markdown fences and I can't parse it. Strip the fences and repair any issues in this output so I get clean JSON back: ```json\n{\"status\": \"ok\", \"results\": [1, 2, 3,]\n```"},{"title":"Truncated JSON recovery in swarm pipeline","prompt":"One of my sub-agents returned a truncated JSON object that got cut off mid-structure — something like {\"report\": {\"title\": \"Q3 Analysis\", \"data\": [. Can you repair it and give me back valid JSON so the next step in my workflow doesn't fail?"}],"resultDescription":"A repaired, valid JSON object reconstructed from the malformed input. The response includes the corrected JSON structure with all common LLM-induced issues resolved — trailing commas removed, markdown fences stripped, single quotes converted to double quotes, and truncated structures closed — making it safe to parse programmatically.","failureModes":["Input JSON too severely malformed to deterministically repair — returns error indicating unrecoverable structure","Empty or whitespace-only raw_json input — returns validation error","Input JSON represents ambiguous structure where multiple valid repairs exist — may return best-effort result or error","Payment failure via x402 protocol — returns HTTP 402 if USDC payment not settled","Network timeout if input string is extremely large"],"whenToPreferThis":"Choose this endpoint when your multi-agent pipeline receives LLM-generated JSON that fails standard JSON.parse() due to common LLM artifacts (trailing commas, markdown code fences, single quotes, truncation). It is especially valuable in automated swarm or A2A pipelines where a single malformed output would otherwise crash a downstream agent. Prefer this over writing custom regex-based fixers when you need a deterministic, hosted, paid-per-call solution that handles the full spectrum of LLM JSON failure modes without maintaining your own repair logic.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-21T07:26:24.033Z","isFirstParty":false,"canonicalSlug":"preflight-agentdiet-dev-deterministic-a2a-broken-json-repair-schema-1d25665d"}