Skip to content

helpers.json

Functions

read_json(path: Path) → Dict[str, Any]

Read a JSON file and return its contents as a dictionary.

Args:
path (Path): Path to the JSON file.

Returns:
dict: Parsed JSON data.

Raises:
FileNotFoundError: If the file does not exist.
json.JSONDecodeError: If the file contains invalid JSON.

write_json(path: Path, data: Dict[str, Any]) → None

Write a dictionary to a JSON file with indentation.

Args:
path (Path): Path to the JSON file.
data (dict): Data to write.