Created
May 28, 2019 01:16
-
-
Save jlevy/da0fbeadc20ce1547967314fb5da07d5 to your computer and use it in GitHub Desktop.
Command-line JSON diff (colorized and with normalized key ordering)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
file1="${1:? | |
Usage: $(basename $0) file1.json file2.json | |
Show diff of JSON, normalizing key ordering. | |
}" | |
file2="${2:?Missing file2}" | |
diff <(jq --sort-keys . < "$file1") <(jq --sort-keys . < "$file2") | colordiff | less -R |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment