Static Analyzer for Solidity
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
slither/scripts/json_diff.py

27 lines
613 B

import sys
import json
4 years ago
from deepdiff import DeepDiff # pip install deepdiff
from pprint import pprint
4 years ago
if len(sys.argv) != 3:
print("Usage: python json_diff.py 1.json 2.json")
exit(-1)
4 years ago
with open(sys.argv[1], encoding="utf8") as f:
d1 = json.load(f)
4 years ago
with open(sys.argv[2], encoding="utf8") as f:
d2 = json.load(f)
# Remove description field to allow non deterministic print
for elem in d1:
4 years ago
if "description" in elem:
del elem["description"]
for elem in d2:
4 years ago
if "description" in elem:
del elem["description"]
pprint(DeepDiff(d1, d2, ignore_order=True, verbose_level=2))