from pathlib import Path
from typing import Union
import json


def load(file: Path) -> Union[dict, list]:
    """Attempt to load a JSON file."""
    if file.exists():
        return json.loads(file.read_text())
    return {}