Skip to main content

Module json_repair

Module json_repair 

Source

Functions§

extract_edit_file_args
Specialized parser for edit_file arguments when JSON parsing fails. Models often generate old_string/new_string with unescaped quotes/newlines. This parser uses the known field order to extract content by position.
extract_json_fields
Last-resort: extract ALL key-value pairs from malformed JSON by string matching. Tool-agnostic — no hardcoded field lists. Finds any "key": "value" or key: value pattern.
repair_json
Attempt to repair common JSON issues from LLM output:
repair_tool_args
JSON repair utilities for malformed LLM tool-call output.