def load_json_from_file()

in envelope-encryption-sample/python-cli/cli.py [0:0]


def load_json_from_file(file_path: str) -> dict:
    """
    Load a JSON object from a file.

    Parameters:
    file_path (str): The path to the file where the JSON object is stored.

    Returns:
    dict: The JSON object loaded from the file.

    """
    try:
        with open(file_path, "r") as file:
            json_data = json.load(file)
        print(f"JSON data successfully loaded from {file_path}")
        return json_data
    except Exception as e:
        print(f"An error occurred while loading JSON data from file: {e}")
        raise e