from typing import Union
import json


def dump_json(path: str, data: Union[dict, list], indent: int = 4) -> str:
    """
    Shortcut for dumping data to a json file.

    Parameters
    ----------
    `path` : str
        The path to the json file.
    `data` : Union[dict, list]
        The json serializable object to dump.
    `indent` int
        Indentation. Defaults to 4.

    Returns
    -------
    `str` :
        The path where the json was dumped.
    """

    with open(path, "w+") as f:
        json.dump(data, f, indent=indent)
    
    return path