{"uid":"cap_zo5Dm9_YdTllR3YRBxQt8","slug":"json-schema-repair-validation-for-agent-outputs-188202e5","name":"JSON Schema Repair & Validation for Agent Outputs","description":"Deterministic JSON repair for agent tool outputs, with optional JSON Schema validation. Built for tight agent loops at micropayment prices.","url":"https://agent.kihustle.tech/services/json-schema-repair/jobs","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"schema":{"type":"object","description":"Optional JSON Schema"},"json_text":{"type":"string","description":"Raw JSON text to repair"}}},"responseSchema":{"type":"json","example":{"job_id":"job_example","status":"completed","service":"json-schema-repair","sources":[{"url":"inline://json_text","note":"client payload"}],"summary":"JSON repair succeeded; repaired=True; schema_check=True. Deterministic repair for agent loops.","parse_ok":true,"repaired":true,"next_jobs":[],"schema_ok":true,"issue_codes":[],"limitations":["Heuristic repair only."],"generated_at":"2026-01-01T00:00:00+00:00","repair_notes":["repair_attempted"],"repaired_json":{"ok":true},"schema_errors":[]}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.01","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.01/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_IdmUrZ83WnmDFp92kCWY0","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.01","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 from agent tool outputs and optionally validates the result against a provided JSON Schema.","exampleAgentPrompt":"The tool call just returned garbled JSON with a missing closing brace — can you run it through the JSON repair service to fix it, and validate the result against this schema: {\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"score\":{\"type\":\"number\"}},\"required\":[\"name\",\"score\"]}?","exampleUseCases":[{"title":"Fix broken LLM tool output mid-loop","prompt":"The LLM just returned this malformed JSON from my tool call: '{\"status\": \"ok\", \"result\": {\"value\": 42,' — repair it so my pipeline can continue without crashing."},{"title":"Schema-enforce agent response before storage","prompt":"I need you to take this JSON blob the agent produced and both fix any syntax errors AND validate it conforms to my schema for a product record before I write it to the database."},{"title":"Recover truncated API response","prompt":"The downstream service returned a truncated JSON response that cuts off mid-string — can you repair it deterministically so I get a valid, parseable object back?"}],"resultDescription":"Returns a repaired, valid JSON object along with metadata about what was fixed. If a JSON Schema was provided, also returns validation results indicating whether the repaired output conforms to the schema, plus any remaining validation errors.","failureModes":["Input JSON is too severely corrupted to deterministically repair — returns error with explanation","Provided JSON Schema is itself invalid — returns schema parse error","Repaired JSON fails schema validation — returns repaired JSON plus validation failure details","Empty or null input — returns 400-level error","Input exceeds size limits — returns size limit error"],"whenToPreferThis":"Use this endpoint when you need deterministic, rule-based JSON repair rather than LLM-based reformatting — ideal for tight agent loops where predictability and low cost ($0.01/call) matter more than creative inference. Prefer it over prompt-based JSON fixing when you need auditability, schema enforcement, or when running at scale in automated pipelines.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T18:36:37.015Z","isFirstParty":false}