LLMs often produce almost valid JSON. Write a repair pass for the most common mistakes, applied outside of strings only:
``` or ```json).} or ].True, False and None with true, false and null (whole words only)." inside them.Implement repair_json(text) returning the repaired string, and loads_lenient(text), which tries json.loads first and only repairs if that fails. If even the repaired text won't parse, loads_lenient raises ValueError.