import json


def write_json(dictionary: dict, path: str) -> str:
    """write a dictionary as json

    Args:
        dictionary (dict): a dictionary that has to be converted to json
        path (str): path to output json file

    Returns:
        str: path to output json file
    """
    try:
        json_object = json.dumps(dictionary, indent=4)
        with open(path, "w") as outfile:
            outfile.write(json_object)
    except Exception as err:
        raise RuntimeError(f"Unable to write json: {err}")

    return path