{"uid":"cap_h9hAra5Pt0zUj6h15XHg8","slug":"preflight-agentdiet-dev-deterministic-a2a-broken-json-repair-schema-b4f31dae","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/json-validator)","url":"https://preflight.agentdiet.dev/v1/json-validator?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_HnVOemqUHIXirCSWww61D","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, malformed, or markdown-wrapped JSON strings (trailing commas, single quotes, fences) so multi-agent pipelines can continue without crashing.","exampleAgentPrompt":"This JSON output from the LLM is broken — it has trailing commas and a markdown code fence wrapping it. Can you repair it so I can use it in the next step of my pipeline? Here it is: ```json {\"name\": \"Alice\", \"age\": 30, } ```","exampleUseCases":[{"title":"Fix LLM output before database write","prompt":"The language model just returned some JSON with trailing commas and single quotes instead of double quotes — it'll break my database insert. Can you repair this raw JSON string for me so it's valid? Here it is: {'user': 'bob', 'score': 42,}"},{"title":"Strip markdown fences from agent response","prompt":"My coding agent wrapped its JSON response in a ```json ... ``` markdown block and now my parser is failing. Can you clean up this malformed output and give me back valid parseable JSON?"},{"title":"Recover truncated JSON from long LLM generation","prompt":"The model hit its token limit mid-response and the JSON got cut off — it's missing the closing braces. Can you repair this truncated JSON so my pipeline doesn't crash? Here's what I got: {\"results\": [{\"id\": 1, \"value\": \"hello\""}],"resultDescription":"A repaired, valid JSON object derived from the malformed input string, with all syntax errors corrected — trailing commas removed, markdown fences stripped, single quotes normalized to double quotes, and truncated structures closed.","failureModes":["Input is so severely malformed that deterministic repair is impossible — returns error indicating unparseable input","Input string is empty or whitespace-only — rejected by minLength:1 validation","JSON is semantically invalid beyond syntactic repair (e.g. conflicting keys) — may return best-effort result with caveats","Network timeout if the service is temporarily unavailable — retry with Idempotency-Key header to avoid duplicate processing"],"whenToPreferThis":"Choose this endpoint when you need deterministic, rule-based JSON repair rather than LLM-based re-generation. It is ideal for multi-agent pipelines where JSON outputs from language models frequently contain markdown fences, trailing commas, or single quotes. Prefer it over writing custom regex logic or asking a second LLM to re-format the output, as it is faster, cheaper, and produces consistent results. Especially useful in production pipelines where reliability and idempotency (via the Idempotency-Key header) are required.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-21T06:43:47.032Z","isFirstParty":false,"canonicalSlug":"preflight-agentdiet-dev-deterministic-a2a-broken-json-repair-schema-1d25665d"}