{"uid":"cap_9DTxrENw739gSJlaePMb_","slug":"netintel-json-repair-956e9b40","name":"NetIntel JSON Repair","description":"Repair malformed JSON into valid JSON — fixes code fences, trailing commas, single quotes, unquoted keys, bad escapes, duplicate keys, truncation, and JSON buried in prose. A deterministic tokenizer runs first (no LLM cost), with an optional Haiku fallback, plus optional schema validation and type coercion — so agents can rescue broken model output or dirty data in one call.","url":"https://netintel.dev/json/repair?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","bodyType","body"],"properties":{"body":{"type":"object","required":["input"],"properties":{"input":{"type":"string","description":"The malformed JSON, as a string. May include markdown code fences or surrounding prose. Max 100KB."},"coerce":{"type":"boolean","description":"Default false. With a schema supplied, coerce values to the declared types where lossless (\"5\" → 5, \"yes\" → true)."},"schema":{"type":"object","description":"Optional. Validate the repaired JSON against this schema. Accepts a flat field→type map ({\"n\":\"number\"}) or a JSON-Schema-shaped object ({\"type\":\"object\",\"properties\":{...},\"required\":[...]}). Types: string, number, integer, boolean, object, array, null."},"allow_llm":{"type":"boolean","description":"Default true. When false, deterministic-only: if the tokenizer cannot fix the input, repair_succeeded is false (still a 200)."}}},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"grade":{"type":"string"},"score":{"type":"number"},"method":{"type":"string"},"changes":{"type":"array"},"findings":{"type":"array"},"repaired":{"type":["object","array","null"]},"warnings":{"type":"array"},"was_valid":{"type":"boolean"},"confidence":{"type":"number"},"schema_valid":{"type":["boolean","null"]},"repair_succeeded":{"type":"boolean"},"validation_errors":{"type":"array"}}}}}}},"responseSchema":{"type":"json","example":{"grade":"A","score":100,"method":"deterministic","changes":["removed markdown code fences","converted 3 single-quoted strings to double-quoted","removed 2 trailing commas"],"findings":[],"repaired":{"name":"acme","ports":[80,443]},"warnings":[],"was_valid":false,"confidence":1,"schema_valid":null,"repair_succeeded":true,"validation_errors":[]}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","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":{"p10Cents":"2.0000","medianCents":"2.0000","p90Cents":"2.0000","minCents":"2.0000","maxCents":"2.0000","p95Cents":"2.0000","sampleCount":1,"varies":false,"failureChargeRate":1},"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_eHNwAmXZTsC0HWPfAiDbY","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Repairs malformed JSON strings into valid JSON using a deterministic tokenizer with optional LLM fallback, schema validation, and type coercion","exampleAgentPrompt":"This JSON came back from the model with trailing commas, single quotes, and some prose around it — can you repair it into valid JSON and validate it against this schema: {\"name\": \"string\", \"age\": \"number\"}? Also coerce types where you can.","exampleUseCases":[{"title":"Rescue broken LLM output","prompt":"The model returned this JSON with markdown code fences and trailing commas and it's breaking my parser — can you repair it into clean valid JSON? Here's the raw output: ```json\n{\"name\": \"Alice\", \"score\": 95,}\n```"},{"title":"Validate and coerce dirty API data","prompt":"I'm getting JSON from a third-party API where numbers come in as strings and some keys are unquoted — can you fix it and coerce the values to the right types based on this schema: {\"id\": \"integer\", \"price\": \"number\", \"active\": \"boolean\"}?"},{"title":"Extract JSON buried in prose","prompt":"This model response has a JSON object buried somewhere in the middle of a long paragraph of text — can you pull out the JSON and return it as a clean, valid object without any surrounding prose?"}],"resultDescription":"Returns a JSON object with: repaired (the fixed JSON as an object/array/null), repair_succeeded (boolean), was_valid (boolean indicating input was already valid), method (how repair was achieved: deterministic or LLM), confidence (0-1 score), grade (letter grade of repair quality), changes (list of modifications made), warnings (non-fatal issues), schema_valid (boolean or null if no schema supplied), and validation_errors (list of schema violations if any).","failureModes":["Input too severely malformed for deterministic tokenizer and allow_llm is false — returns repair_succeeded: false with a 200","Input exceeds 100KB limit — returns an error","Schema validation fails after successful repair — repair_succeeded is true but schema_valid is false with validation_errors populated","LLM fallback unavailable or fails — falls back to deterministic result or returns repair_succeeded: false","Input is valid JSON already — returns was_valid: true with no changes"],"whenToPreferThis":"Choose this endpoint when you need to rescue broken JSON from LLM outputs, dirty data pipelines, or third-party APIs — especially when you want deterministic repair (no LLM cost) with an optional LLM fallback for trickier cases, plus built-in schema validation and type coercion in one call. Prefer it over hand-rolled parsers or generic LLM prompting when you need auditability (changes list, grade, confidence) and pay-per-call pricing without managing API keys.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-11T12:47:23.545Z","isFirstParty":false,"canonicalSlug":"netintel-json-repair-956e9b40"}