{"id":"json-repair-diagnose","version":"1.0.0","description":"Classify JSON text as valid, repairable or unrepairable and locate each lexical defect and refusal by line and column.","supported_operations":["why is this json invalid","find lexical errors in json text","can this broken json be repaired safely","line and column of json syntax problems","count trailing commas and comments in json","check llm json output before parsing","אבחון שגיאות תחביר בפלט נתונים"],"unsupported_operations":["return the repaired text (use json-text-repair)","validate JSON against a schema","report every error after the first unrepairable one"],"semantics":["Uses exactly the json-text-repair engine (ECMA-404 / RFC 8259 grammar plus six repairable defects: byte_order_mark, comment, trailing_comma, single_quoted_string, unquoted_key, python_literal). It never throws for unrepairable text; it reports it.","status is \"valid\" (strict JSON, no defects), \"repairable\" (json-text-repair would succeed with defect_count edits) or \"unrepairable\" (refusal is set to the first refusal reason and its position).","defects lists every defect in text order when repairable; when unrepairable it lists only the defects found before the refusal point. counts always has all six kinds.","Offsets are code point indices; line and column are 1-based, columns count code points, and LF, CR and CRLF each end one line (RFC 8259 whitespace).","Refusal reasons: empty_text, unexpected_character, unexpected_token, unexpected_end, trailing_content, unterminated_string, invalid_escape, control_character_in_string, invalid_number, unknown_identifier, ambiguous_key, unterminated_comment, duplicate_key (names compared after decoding, at every nesting level).","Limits: text at most 65536 UTF-8 bytes (checked first), nesting depth at most 64, at most 256 defects; each overflow is limit_exceeded rather than a partial report."],"limits":{"max_text_bytes":65536,"max_depth":64,"max_edits":256},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["text"],"properties":{"text":{"type":"string","description":"JSON-like text, at most 65536 UTF-8 bytes."}}},"output_schema":{"type":"object","additionalProperties":false,"required":["status","defect_count","counts","defects","refusal"],"properties":{"status":{"type":"string","enum":["valid","repairable","unrepairable"]},"defect_count":{"type":"integer","minimum":0,"maximum":256},"counts":{"type":"object","additionalProperties":false,"required":["byte_order_mark","comment","trailing_comma","single_quoted_string","unquoted_key","python_literal"],"properties":{"byte_order_mark":{"type":"integer","minimum":0,"maximum":256},"comment":{"type":"integer","minimum":0,"maximum":256},"trailing_comma":{"type":"integer","minimum":0,"maximum":256},"single_quoted_string":{"type":"integer","minimum":0,"maximum":256},"unquoted_key":{"type":"integer","minimum":0,"maximum":256},"python_literal":{"type":"integer","minimum":0,"maximum":256}}},"defects":{"type":"array","maxItems":256,"items":{"type":"object","additionalProperties":false,"required":["kind","start","end","line","column"],"properties":{"kind":{"type":"string","enum":["byte_order_mark","comment","trailing_comma","single_quoted_string","unquoted_key","python_literal"]},"start":{"type":"integer","minimum":0,"maximum":65536},"end":{"type":"integer","minimum":0,"maximum":65536},"line":{"type":"integer","minimum":1,"maximum":65537},"column":{"type":"integer","minimum":1,"maximum":65537}}}},"refusal":{"oneOf":[{"type":"null"},{"type":"object","additionalProperties":false,"required":["reason","offset","line","column"],"properties":{"reason":{"type":"string","enum":["empty_text","unexpected_character","unexpected_token","unexpected_end","trailing_content","unterminated_string","invalid_escape","control_character_in_string","invalid_number","unknown_identifier","ambiguous_key","unterminated_comment","duplicate_key"]},"offset":{"type":"integer","minimum":0,"maximum":65536},"line":{"type":"integer","minimum":1,"maximum":65537},"column":{"type":"integer","minimum":1,"maximum":65537}}}]}}},"examples":[{"input":{"text":"{'a': 1,\n 'b': None}"},"output":{"status":"repairable","defect_count":3,"counts":{"byte_order_mark":0,"comment":0,"trailing_comma":0,"single_quoted_string":2,"unquoted_key":0,"python_literal":1},"defects":[{"kind":"single_quoted_string","start":1,"end":4,"line":1,"column":2},{"kind":"single_quoted_string","start":10,"end":13,"line":2,"column":2},{"kind":"python_literal","start":15,"end":19,"line":2,"column":7}],"refusal":null}},{"input":{"text":"{\"a\": 1, \"a\": 2}"},"output":{"status":"unrepairable","defect_count":0,"counts":{"byte_order_mark":0,"comment":0,"trailing_comma":0,"single_quoted_string":0,"unquoted_key":0,"python_literal":0},"defects":[],"refusal":{"reason":"duplicate_key","offset":9,"line":1,"column":10}}}],"execute_url":"/v1/tools/json-repair-diagnose/versions/1.0.0/execute"}