I want to diff two JSON text files. Unfortunately they\'re constructed in arbitrary order, so I get diffs when they\'re semantically identical. I\'d like to use jq (or whateve
I want to diff two JSON text files.
Use jd with the -set
option:
No output means no difference.
$ jd -set A.json B.json
Differences are shown as an @ path and + or -.
$ jd -set A.json C.json
@ ["People",{}]
+ "Carla"
The output diffs can also be used as patch files with the -p
option.
$ jd -set -o patch A.json C.json; jd -set -p patch B.json
{"City":"Boston","People":["John","Carla","Bryan"],"State":"MA"}
https://github.com/josephburnett/jd#command-line-usage