Skip to content

Instantly share code, notes, and snippets.

@jlevy jlevy/diffjson
Created May 28, 2019

Embed
What would you like to do?
Command-line JSON diff (colorized and with normalized key ordering)
#!/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
You can’t perform that action at this time.