{"uid":"cap_5PrkUJC8xLvOAOU6UMjzn","slug":"polymarket-odds-agentdiet-dev-deterministic-json-repair-schema-c0f2c954","name":"Deterministic 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://polymarket-odds.agentdiet.dev/v1/structured-output)","url":"https://polymarket-odds.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__1nfRy5EiSzxariAe_kG1","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":"polymarket-odds.agentdiet.dev","brandSlug":"polymarket-odds-agentdiet-dev-mpp","brandBaseUrl":"https://polymarket-odds.agentdiet.dev","brandDocsUrl":null,"whatItDoes":"Repairs malformed, truncated, or markdown-wrapped LLM JSON outputs (trailing commas, single quotes, fenced code blocks) so they become valid, parseable JSON","exampleAgentPrompt":"This JSON from my LLM response is broken — it has trailing commas and markdown code fences wrapping it. Can you repair it so it's valid JSON I can parse? Here's the raw string: ```json {\"name\": \"Alice\", \"age\": 30, } ```","exampleUseCases":[{"title":"Fixing LLM output in agent pipeline","prompt":"My AI model just returned a JSON response that has trailing commas and is wrapped in markdown fences. Can you clean it up and give me valid JSON? Here's what it returned: ```json {'name': 'Bob', 'score': 42,} ```"},{"title":"Recovering truncated JSON from long generation","prompt":"This JSON got cut off mid-generation and now it's invalid — can you repair and close it so it parses correctly? The broken string is: {\"results\": [{\"id\": 1, \"value\": \"foo\"}, {\"id\": 2"},{"title":"Sanitizing single-quote JSON before database insert","prompt":"I have a JSON blob from an older LLM that used single quotes instead of double quotes throughout. Fix it to proper JSON so I can parse and store it: {'user': 'carol', 'active': true, 'score': 98}"}],"resultDescription":"Returns a repaired, valid JSON object where all syntax errors — trailing commas, markdown fences, single quotes, truncation — have been deterministically corrected, ready to be parsed or passed to the next stage of an agent pipeline.","failureModes":["Input is so severely malformed that deterministic repair is impossible — may return an error or best-effort partial result","Input string is not JSON-like at all (e.g. plain text prose) — repair may fail or produce nonsensical output","Extremely long truncated JSON may not be recoverable without missing context","Rate limiting or payment failure via x402 if USDC balance is insufficient"],"whenToPreferThis":"Use this endpoint when an LLM or agent in your pipeline produces structurally invalid JSON that would crash a downstream parser — especially when the issues are predictable syntax errors like trailing commas, markdown wrapping, or single quotes. Prefer this over re-prompting the LLM when speed and determinism matter more than semantic correction. Ideal for multi-agent workflows where you cannot afford pipeline failures due to malformed JSON.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-21T07:24:26.219Z","isFirstParty":false,"canonicalSlug":"polymarket-odds-agentdiet-dev-deterministic-json-repair-schema-ea02c706"}