import json from pathlib import Path from typing import Any, Dict def load_json(p: Path) -> Dict[str, Any]: with open(p, "r", encoding="utf-8") as f: return json.load(f) def save_json(p: Path, data: Dict[str, Any]): p.parent.mkdir(parents=True, exist_ok=True) with open(p, "w", encoding="utf-8") as f: json.dump(data, f, ensure_ascii=False, indent=2)