def save_json_to_file()

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


def save_json_to_file(json_data: str, file_path: str) -> None:
    """
    Save a JSON object to a file.

    Parameters:
    json_data (dict): The JSON object to save.
    file_path (str): The path to store the JSON object.

    """
    try:
        with open(file_path, "w") as file:
            json.dump(json_data, file, indent=4)
        print(f"JSON data successfully saved to {file_path}")
    except Exception as e:
        print(f"An error occurred while saving JSON data to file: {e}")
        raise e