import json
import sys
def Compares(j1:dict,j2:dict,oldkey = "root-"):
for key in j1.keys():
if j2.get(key) is not None:
if type(j1[key]) == list:
for i in j1[key]:
if i not in j2[key]:
print(oldkey + key + "不同")
elif type(j1[key]) == dict:
Compares(j1[key],j2[key],oldkey + key+"-")
else:
if j1[key] != j2[key]:
print(oldkey + key + "不同")
if __name__ == '__main__':
if len(sys.argv)<3:
jsonfile1 = input("第一个地址:")
jsonfile2 = input("第二个地址:")
else:
jsonfile1 = sys.argv[1]
jsonfile2 = sys.argv[2]
j1 = json.loads(open(jsonfile1,'r').read())
j2 = json.loads(open(jsonfile2,'r').read())
Compares(j1,j2)