{"id":"json-repair-map-offsets","version":"1.0.0","description":"Map code point offsets between JSON text and its lexical repair, flagging offsets that fall inside an edit.","supported_operations":["map json parse error position back to the original text","translate offsets after repairing json","where does this repaired json position come from","convert positions between broken and fixed json","source map for json repair edits","מיפוי מיקומים בין טקסט מקורי לטקסט מתוקן"],"unsupported_operations":["map offsets for structural repairs such as closing truncated JSON","convert between code point, UTF-16 and byte offsets","map JSON Pointer paths to offsets"],"semantics":["Runs the json-text-repair engine on text (same six defects and refusals); unrepairable text is invalid_input with details {reason, offset}.","Offsets are code point boundaries from 0 to the length of the source side: the original text for original_to_repaired, the repaired text for repaired_to_original. Out-of-range offsets are invalid_input.","An offset at or before an edit start, or at or after its end, maps exactly (exact true) by the cumulative length change of the preceding edits. An offset strictly inside an edited range maps to the start of the corresponding range on the other side with exact false.","Deletions (comments, trailing commas, byte order mark) map both their start and end to the same repaired offset; insertions of quotes around keys widen a range, so its inner repaired offsets map back inexactly.","mappings keep the input order and duplicates. Limits: text at most 65536 UTF-8 bytes (checked first), nesting depth 64, at most 256 edits and at most 256 offsets; each overflow is limit_exceeded."],"limits":{"max_text_bytes":65536,"max_depth":64,"max_edits":256,"max_offsets":256},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["text","offsets","direction"],"properties":{"text":{"type":"string","description":"The original JSON-like text, at most 65536 UTF-8 bytes."},"offsets":{"type":"array","maxItems":256,"items":{"type":"integer","minimum":0}},"direction":{"type":"string","enum":["original_to_repaired","repaired_to_original"]}}},"output_schema":{"type":"object","additionalProperties":false,"required":["direction","original_length","repaired_length","edit_count","mappings"],"properties":{"direction":{"type":"string","enum":["original_to_repaired","repaired_to_original"]},"original_length":{"type":"integer","minimum":0,"maximum":131072},"repaired_length":{"type":"integer","minimum":0,"maximum":131072},"edit_count":{"type":"integer","minimum":0,"maximum":256},"mappings":{"type":"array","maxItems":256,"items":{"type":"object","additionalProperties":false,"required":["offset","mapped","exact"],"properties":{"offset":{"type":"integer","minimum":0,"maximum":131072},"mapped":{"type":"integer","minimum":0,"maximum":131072},"exact":{"type":"boolean"}}}}}},"examples":[{"input":{"text":"{a: 1, /*x*/ b: 2,}","offsets":[0,1,2,9,13,18,19],"direction":"original_to_repaired"},"output":{"direction":"original_to_repaired","original_length":19,"repaired_length":17,"edit_count":4,"mappings":[{"offset":0,"mapped":0,"exact":true},{"offset":1,"mapped":1,"exact":true},{"offset":2,"mapped":4,"exact":true},{"offset":9,"mapped":9,"exact":false},{"offset":13,"mapped":10,"exact":true},{"offset":18,"mapped":16,"exact":true},{"offset":19,"mapped":17,"exact":true}]}},{"input":{"text":"{a: 1}","offsets":[1,2,4,5],"direction":"repaired_to_original"},"output":{"direction":"repaired_to_original","original_length":6,"repaired_length":8,"edit_count":1,"mappings":[{"offset":1,"mapped":1,"exact":true},{"offset":2,"mapped":1,"exact":false},{"offset":4,"mapped":2,"exact":true},{"offset":5,"mapped":3,"exact":true}]}}],"execute_url":"/v1/tools/json-repair-map-offsets/versions/1.0.0/execute"}