import argparse, json parser = argparse.ArgumentParser(description="Calculate diff between holder lists") parser.add_argument('-a', '--a', help="First json file") parser.add_argument('-b', '--b', help="Second json file") parser.add_argument('-o', '--output', help="Output json file") args = parser.parse_args() with open(args.a) as f: a_data = json.load(f) a = {k.lower(): v for k, v in a_data.items()} with open(args.b) as f: b_data = json.load(f) b = {k.lower(): v for k, v in b_data.items()} different_values = {} only_in_a = {} for key in a: if key in b: if a[key] != b[key]: different_values[key] = { "a": a[key], "b": b[key] } else: only_in_a[key] = a[key] continue only_in_b = {} for key in b: if key not in b: only_in_b[key] = b[key] print('Only in A:', len(only_in_a)) print('Only in B:', len(only_in_b)) with open(args.output, 'w') as f: json.dump({ "only_in_a": only_in_a, "only_in_b": only_in_b, "different_value": different_values }, f, indent=2)