2026/1/20 2:25:19
网站建设
项目流程
网站建设设计策划,WordPress百度怎么不收录,全网营销有哪些平台,网络服务器是指什么1、少量文件对比可以使用在线Json对比工具#xff0c;比如#xff1a; JSON Diff - The semantic JSON compare tool https://jsoncompare.com/ 都是不错的在线Json对比工具#xff1b;
2、如果是大量的json文件需要对比#xff0c;直接用 Byond Compare对比#xff0c;由…1、少量文件对比可以使用在线Json对比工具比如JSON Diff - The semantic JSON compare toolhttps://jsoncompare.com/都是不错的在线Json对比工具2、如果是大量的json文件需要对比直接用 Byond Compare对比由于对比工具不支持json格式化会比较难观察差异点所以首先需要对json文件做预处理使用以下脚本放在j和jison文件放在同一个文件夹下执行脚本预处理之后再使用Byond Compare工具进行对比就可以很方便的观察到差异点了。# coding:utf8 import json import sys,os def getFileCon(filename): if not os.path.isfile(filename): return with open(filename, r) as f: con f.read() f.close() return con def writeFile(filepath,con): with open(filepath, w) as f: f.write(con) f.close() if __name__ __main__: fl os.listdir(.) for f in fl: g f if not f.endswith(.json): continue try: con json.loads(getFileCon(f)) # print con # writeFile(f,json.dumps(con,indent4,ensure_asciiFalse).decode(utf8)) writeFile(f,json.dumps(con,indent4,ensure_asciiFalse)) print (g,OK) except Exception as e: print (g,is not json format)