Method A: Using pathlib (modern and clean)

def read_json(file_path: str | Path): path = Path(file_path) with path.open('r', encoding='utf-8') as file: return json.load(file)