{"uid":"cap_8aIa8g0exZcaNOeEcpOYu","slug":"preflight-agentdiet-dev-deterministic-a2a-broken-json-repair-schema-324cf2b2","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/structured-output)","url":"https://preflight.agentdiet.dev/v1/structured-output?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_cq1ig6zJM3R_tyDaz-5wz","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) deterministically so multi-agent pipelines never crash on bad JSON.","exampleAgentPrompt":"This JSON came back from the LLM with trailing commas and markdown fences around it — can you clean it up and give me valid parseable JSON? Here it is: ```{\"name\": \"Alice\", \"age\": 30,}```","exampleUseCases":[{"title":"Fix crashed agent pipeline JSON","prompt":"My multi-agent pipeline just crashed because the LLM returned malformed JSON with trailing commas. Can you repair this string so it parses cleanly? Here's the broken output: {\"status\": \"ok\", \"results\": [\"a\", \"b\",]}"},{"title":"Strip markdown fences from LLM response","prompt":"The model wrapped its JSON in triple backticks and now my parser is failing. Can you strip the markdown fences and fix any other issues in this output? ```json\n{\"user\": 'Alice', \"score\": 42}\n```"},{"title":"Validate and repair truncated structured output","prompt":"My LLM response got cut off mid-JSON — it looks like it ends abruptly at {\"items\": [{\"id\": 1, \"value\": \"foo\". Can you repair and complete it into valid JSON so I can continue processing?"}],"resultDescription":"A repaired, valid JSON object that has been cleaned of common LLM output defects including trailing commas, markdown code fences, single-quoted strings, and truncation artifacts — ready to parse without errors in downstream agent pipelines.","failureModes":["Input JSON is so severely malformed it cannot be deterministically repaired — returns an error or best-effort partial output","Truncated JSON missing critical closing structure may produce semantically incorrect repairs","Very large JSON strings may hit query parameter length limits since raw_json is passed via GET query string","Non-JSON input (e.g. plain text, binary) will fail to parse or return an error"],"whenToPreferThis":"Choose this endpoint when your AI agent or multi-agent pipeline receives structured output from an LLM that fails JSON.parse() due to common LLM formatting errors like trailing commas, markdown fences, or single quotes. Prefer this over custom regex fixes or retry logic when you need a deterministic, low-latency repair step that doesn't require another LLM call. Ideal for production pipelines where JSON parsing failures are a common bottleneck.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-21T12:47:48.984Z","isFirstParty":false,"canonicalSlug":"preflight-agentdiet-dev-deterministic-a2a-broken-json-repair-schema-1d25665d"}