Load JSON from file, return None if file doesn't exist.
(filepath: str)
| 23 | json.dump(data, f, indent=4, ensure_ascii=False) |
| 24 | |
| 25 | @staticmethod |
| 26 | def load_json(filepath: str) -> Optional[Dict[str, Any]]: |
| 27 | """Load JSON from file, return None if file doesn't exist.""" |
| 28 | if not os.path.exists(filepath): |
| 29 | return None |
| 30 | |
| 31 | with open(filepath, "r", encoding="utf-8") as f: |
| 32 | return json.load(f) |
| 33 | |
| 34 | @staticmethod |
no test coverage detected