Comparing two json files : shell scripting
Just to update on the answer from bartolomeon_n, you can actually do this all on one line.
diff <(jq -S . fileA.json) <(jq -S . fileB.json)
# or, with nice columns and colours:
diff -y --left-column --color <(jq -S . fileA.json) <(jq -S . fileB.json)
To compare json files you should convert them so they have same order of keys. Very good tool for this job is jq (https://stedolan.github.io/jq/) where you can do:
jq -S . fileA.json > fileA_fmt.json
jq -S . fileB.json > fileB_fmt.json
then, you can use your favourite tool for text file comparison. I like kdiff3 for GUI or just plain diff when in pure command-line e.g.:
diff fileA_fmt.json fileB_fmt.json
Just use diff. Like in
diff --unified file1.json file2.json