I have two json
files. Both files have the same attributes but different values. I need a python utility that compares both files, read their attributes and find those attributes which have different values.
CodePudding user response:
Should do what you're looking for, assuming I read the question right.
import json
data1 = json.load(open('data1.json'))
data2 = json.load(open('data2.json'))
for item in data1.keys():
if data2[item] != data1[item]:
print(f"{item} has differences")