{"uid":"cap_7MvxVYhxtc5LnEEgQIvZ0","slug":"x402-json-repair-245f8cef","name":"x402 JSON Repair","description":"Deterministic JSON / tool-call repair for AI agents. No LLM inside, sub-50ms.","url":"https://x402-json-repair.husquatch.workers.dev/repair","method":"POST","headers":{},"bodySchema":{"type":"object","required":["input"],"properties":{"input":{"type":"string","description":"Possibly-malformed JSON string to repair"},"schema":{"type":"object","description":"Optional JSON Schema (draft 2020-12) to validate the repaired result against"}}},"responseSchema":{"type":"object","required":["repaired","changed"],"properties":{"valid":{"type":["boolean","null"]},"changed":{"type":"boolean"},"repaired":{"description":"The repaired, parsed JSON value"},"validationErrors":{"type":["array","null"],"items":{"type":"object"}}}},"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_YztvsorJlp84xbmdhwhkP","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":"Deterministically repairs malformed JSON strings and optionally validates the repaired result against a JSON Schema, with no LLM involved and sub-50ms latency.","exampleAgentPrompt":"Can you repair this broken JSON string for me — `{\"name\": \"Alice\", \"age\": 30,}` — and validate it against my schema to make sure the result is well-formed?","exampleUseCases":[{"title":"Fix malformed LLM tool-call output","prompt":"The AI tool call I just got back has a syntax error — trailing comma and an unclosed bracket. Can you repair this JSON so I can parse it: `{\"action\": \"search\", \"query\": \"best coffee\",`?"},{"title":"Validate AI-generated config against schema","prompt":"I have a JSON config that my AI generated but I'm not sure it's valid against my schema — can you repair any syntax issues and then check it against this JSON Schema: {\"type\":\"object\",\"required\":[\"host\",\"port\"]}? The JSON is `{\"host\": \"localhost\" \"port\": 8080}`"},{"title":"Recover truncated API response JSON","prompt":"I got a truncated JSON response from an external API that's missing its closing braces — can you fix and return a parseable version of `{\"results\": [{\"id\": 1, \"value\": \"foo\"`?"}],"resultDescription":"Returns an object with `repaired` (the fixed, parsed JSON value), `changed` (boolean indicating whether any repair was made), `valid` (boolean or null indicating schema validation result if a schema was provided), and `validationErrors` (array of schema validation error details, or null).","failureModes":["Input is so severely malformed that deterministic repair is not possible — no LLM fallback","Schema provided is invalid draft 2020-12 — validation step may error or be skipped","Input is not a string — required field missing causes 400-class error","Repaired JSON fails schema validation — returns validationErrors array with details","Payment not authorized — x402 payment required before request is processed"],"whenToPreferThis":"Choose this endpoint when you need fast, deterministic, non-LLM JSON repair — ideal for fixing AI-generated tool calls or API responses in agent pipelines where latency matters and you cannot afford an additional LLM call. Prefer it over LLM-based repair when you need sub-50ms response times, reproducible behavior, and optional schema validation in a single call.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-13T18:33:06.931Z","isFirstParty":false}