{"uid":"cap_JGBkNhnWzdF7ZQ2HTVKmU","slug":"json-repair-schema-validation-3f81c0a5","name":"JSON Repair & Schema Validation","description":"Repair malformed JSON (trailing commas, single quotes, unquoted keys, code fences, truncated output) and optionally validate the result against a supplied JSON Schema. Returns the parsed value, the canonical text, a change log and validation errors.","url":"https://x402.fenixfoundry.com/repair-json","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"input":{"type":"string","description":"Malformed JSON text — trailing commas, single quotes, unquoted keys, markdown code fences, truncated output, etc."},"schema":{"type":"object","description":"Optional JSON Schema (draft 2020-12) to validate the repaired value against."}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.003","displayCostAsset":"USDC","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.003/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.003","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.003","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_4Sq1HNigvIG4X_XMy0zHq","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.003","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Repairs malformed JSON (trailing commas, single quotes, unquoted keys, code fences, truncated output) and optionally validates the fixed result against a JSON Schema, returning the parsed value, canonical text, change log, and validation errors.","exampleAgentPrompt":"This JSON snippet from the LLM has trailing commas and single-quoted keys — can you repair it and validate it against this schema: {\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"age\":{\"type\":\"integer\"}},\"required\":[\"name\",\"age\"]}?","exampleUseCases":[{"title":"Fixing LLM-generated JSON output","prompt":"The model returned JSON wrapped in a markdown code fence with trailing commas — can you strip the fences, fix the commas, and give me a clean parseable JSON object back?"},{"title":"Validating pipeline data against a schema","prompt":"I have this JSON string with unquoted keys that I need cleaned up AND validated against my schema to make sure all required fields are present before I pass it downstream."},{"title":"Recovering truncated API response JSON","prompt":"My API response got cut off mid-JSON and now it won't parse — can you try to repair the truncated output and tell me what changes were made to fix it?"}],"resultDescription":"Returns the repaired parsed JSON value, the canonical (prettified) JSON text, a structured change log describing every modification made during repair, and any validation errors if a JSON Schema was supplied.","failureModes":["Input is so severely malformed that repair is impossible — returns an error describing what could not be recovered","Supplied JSON Schema is itself invalid — returns a schema validation error","Truncation is too severe to infer the intended structure — partial repair with noted ambiguities","Network or payment failure — HTTP 402 if payment not processed correctly"],"whenToPreferThis":"Choose this endpoint when you need to both repair AND optionally validate JSON in a single call, especially for LLM-generated output that commonly has trailing commas, single quotes, unquoted keys, or markdown code fences. Ideal for agent pipelines where downstream steps require strict JSON compliance and you want a detailed change log of what was fixed.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T00:33:39.878Z","isFirstParty":false}