{"uid":"cap_893yzF-P8mvy0oHgJCsCM","slug":"preflight-agentdiet-dev-deterministic-a2a-broken-json-repair-schema-7977c334","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/malformed-json-healer)","url":"https://preflight.agentdiet.dev/v1/malformed-json-healer?utm_source=zero.xyz","method":"POST","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_GRny8HHPeuYersEksyaFP","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, truncation) so multi-agent pipelines can continue without crashing.","exampleAgentPrompt":"This JSON from the LLM response is broken — it has trailing commas, markdown backtick fences, and got cut off mid-object. Can you repair it so the pipeline doesn't crash? Here's the raw string: ```{\"name\": \"Alice\", \"age\": 30, \"tags\": [\"dev\", \"ml\",]}```","exampleUseCases":[{"title":"Fix LLM output crashing agent pipeline","prompt":"The JSON my LLM just returned has trailing commas and got truncated halfway through — can you repair it so my downstream agent can parse it? Here's the broken string: {\"result\": \"ok\", \"items\": [1, 2, 3,}"},{"title":"Strip markdown fences from model response","prompt":"My model wrapped its JSON output in triple backticks and now my parser is failing. Can you strip the markdown fences and give me clean, valid JSON? The raw output is: ```json\n{\"status\": \"success\", \"score\": 0.87}\n```"},{"title":"Repair single-quote JSON from scraping agent","prompt":"I have a JSON-like string from a web scraping step that uses single quotes instead of double quotes — it's not valid JSON and my pipeline errors out. Can you convert it to proper JSON? Here it is: {'name': 'Acme Corp', 'revenue': 5000000}"}],"resultDescription":"Returns a repaired, valid JSON object that has been sanitized of common LLM output artifacts such as trailing commas, markdown code fences, single quotes, and truncation errors — ready for downstream parsing and schema validation in agent pipelines.","failureModes":["Input is so severely malformed that deterministic repair is impossible — returns error indicating unrecoverable JSON","Input string is empty or null — returns validation error for missing required field","JSON is structurally ambiguous (e.g. multiple competing interpretations of truncation point) — may return best-effort repair with low confidence","Network timeout or service unavailability — returns HTTP 5xx","Payment not fulfilled — returns HTTP 402 requiring x402 payment flow"],"whenToPreferThis":"Choose this endpoint when you have LLM-generated or agent-produced JSON that fails standard JSON.parse due to common artifacts like trailing commas, markdown wrapping, single quotes, or truncation, and you need a deterministic (non-LLM) repair rather than sending the broken payload back to a language model. Particularly valuable in high-reliability multi-agent pipelines where a crashed parser blocks downstream steps and retrying the LLM is too costly or slow.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-21T00:37:58.228Z","isFirstParty":false,"canonicalSlug":"preflight-agentdiet-dev-deterministic-a2a-broken-json-repair-schema-1d25665d"}