3 ms·
Diffing JSON as text must be painful. Diffing JSON as data should be somewhat simple.
by stephengillie 8y ago
Diffing JSON as text must be painful. Diffing JSON as data should be somewhat simple.
- justin66 8y agoAre there any merge tools that offer features for this a lot more sophisticated than basic text comparison?
- stephengillie 8y agoPowershell has Compare-Object, which will diff .NET objects. It has the convenient alias "diff". JSON can be converted to .NET objects by ConvertFrom-JSON. So you can import 2 JSON files and diff them in Powershell.
- avip 8y agoNot merge, but jq can diff, and it can also do a consistent dump (jq -cS) for you. Edit: to clarify, jq -S does deep keys sorting. $ echo '{"z":{"b": "second", "a": "first"}, "x": 4, "y": 7}' | jq -S { "x": 4, "y": 7, "z": { "a": "first", "b": "second" } }