1读取json文件
#读取json文件
def get_json(json_file):
with open(json_file, 'r', encoding='utf-8') as f:
res = json.load(f)
return res
2将字典数据保存成json文件
#将字典数据保存为json文件
def write_dict_2_josn(path,data_dict):
json_data = json.dumps(data_dict, ensure_ascii=False, indent=5)
with open(path, 'w', encoding='utf-8') as w:
w.write(json_data)