A jsondiff tool.
{
"People": ["John", "Bryan"],
"City": "Boston",
"State": "MA"
}
{
"People": ["John", "Bryan", "Carla"],
"City": "Boston",
"State": "MA"
}
{
"People": ["John", "Bryan", "Carla"],
"City": "Boston",
"State": "ElseWhere"
}
[ano@nymous]~/jsondiff$ ./bin/jsondiff.via-lib samples/a.json samples/b.json # same content, no diff
[ano@nymous]~/jsondiff$ ./bin/jsondiff.via-lib samples/a.json samples/c.json
["+", {".People[]":"Carla"}]
[ano@nymous]~/jsondiff$ ./bin/jsondiff.via-lib samples/a.json samples/d.json
["+", {".People[]":"Carla"}]
["-", {".State":"MA"}]
["+", {".State":"ElseWhere"}]
["+", {".People[]":"Carla"}]
["-", {".State":"MA"}]
["+", {".State":"ElseWhere"}]
jq -s -c 'map( .[1] |= ((to_entries|(map(.key, .value))) )|flatten(1) ) |.[]'
["+",".People[]","Carla"]
["-",".State","MA"]
["+",".State","ElseWhere"]
jq -s -c -r 'map( (.[1]|sub("^\\.";"")) + ("") + (" "*(15 - (.[1]|length)))+ "" + .[0] + " " + .[2]) |.[]'
People[] + Carla
State - MA
State + ElseWhere