{"uid":"cap_BfbSsGwnMmPqKQyibC2Ls","slug":"agentdiet-structured-output-json-repair-schema-validator-4f0e31ce","name":"AgentDiet Structured Output — 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://agentdiet.dev/v1/structured-output)","url":"https://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":["x402"],"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":"unknown","protocol":"x402","network":"base","amountUsd":null,"per":"call","confidence":"unknown"},{"kind":"static","protocol":"mpp","network":"tempo","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_U6gnt3HsQ5yGyd7UPsesU","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null},{"uid":"pm_ig550FkoOibLx4kIzNvhp","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Repairs truncated or malformed LLM JSON outputs (trailing commas, markdown fences, single quotes) and validates them against schemas so multi-agent pipelines never crash.","exampleAgentPrompt":"This JSON from the LLM is broken — it has trailing commas and markdown fences wrapping it. Can you repair it and give me back clean, valid JSON? Here's the raw string: ```{\"name\": \"Alice\", \"age\": 30,}```","exampleUseCases":[{"title":"Fix broken LLM JSON in agent pipeline","prompt":"The last agent in my pipeline returned malformed JSON with trailing commas and single quotes instead of double quotes. Can you repair it so the next step doesn't crash? Here's the raw output: {\"status\": 'ok', \"count\": 5,}"},{"title":"Strip markdown fences from LLM JSON response","prompt":"My language model wrapped its JSON response in triple-backtick markdown fences and now my parser is failing. Can you clean it up and give me back raw valid JSON? The raw string is: ```json\n{\"result\": \"success\"}\n```"},{"title":"Validate and repair truncated structured output","prompt":"I got a JSON object back from my LLM that got cut off mid-way — it's missing closing braces. Can you repair the truncation and return a valid JSON object from this partial string: {\"user\": {\"id\": 42, \"name\": \"Bob\""}],"resultDescription":"A repaired, syntactically valid JSON object with all common LLM-induced malformations fixed — trailing commas removed, markdown fences stripped, single quotes replaced with double quotes, truncations resolved — ready for downstream consumption in an agent pipeline.","failureModes":["Input JSON is so severely malformed it cannot be deterministically repaired — returns error indicating unparseable input","Schema mismatch if output validation is requested and repaired JSON does not conform — returns validation error with field details","Empty or null raw_json input — returns 400-style error","Non-JSON input (e.g. plain text prose) — may return error or attempt best-effort repair with low confidence"],"whenToPreferThis":"Choose this endpoint when your multi-agent pipeline receives JSON from an LLM that may contain trailing commas, markdown code fences, single quotes, or truncation artifacts and you need deterministic repair before passing to the next stage. Prefer this over prompt-engineering retries when reliability and latency matter, or when you cannot re-invoke the LLM.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-20T12:48:20.843Z","isFirstParty":false,"canonicalSlug":"agentdiet-structured-output-json-repair-schema-validator-4f0e31ce"}