import os import json def read_json_file(json_file_path): if os.path.exists(json_file_path): with open(json_file_path, "r") as json_file: return json.load(json_file) return {} def write_json_file(json_file_path, data): json.dump(obj=data, fp=json_file_path, indent=2)