Use jq to first sort all keys. Then diff to do the diffing:
jq -S . A.json > A-sorted.json
jq -S . B.json > B-sorted.json
diff A-sorted.json B-sorted.json
The above example is for Linux but both jq and diff is available for Windows.
It seems Windows has an alternative diff tool called fc, perhaps this could be used instead of diff.
windows - Offline JSON diff tool - Software Recommendations Stack Exchange
Built a Tool for Deep JSON Comparison - Seeking Input on Array Diff Visualization
Best way to diff two JSON files and write differences data to third file?
New JSON diff algorithm
Videos
ยป npm install json-diff
Use jq to first sort all keys. Then diff to do the diffing:
jq -S . A.json > A-sorted.json
jq -S . B.json > B-sorted.json
diff A-sorted.json B-sorted.json
The above example is for Linux but both jq and diff is available for Windows.
It seems Windows has an alternative diff tool called fc, perhaps this could be used instead of diff.
QT JSON Diff [Github] might be for you:
- They have a Windows build (see "Win64" in the releases)
- It is gratis, MIT license
- It works offline, as an EXE which runs locally
- can sort objects inside arrays so that order matters less
ยป npm install json-diff-ts
Hey r/golang community,
I've been grappling with a recurring challenge in my work: comparing large, deeply nested JSON files. To tackle this, I created a CLI tool in Go that helps highlight differences between two JSON files with high precision.
The tool is relatively compact, about 200 lines of code, and handles different types of changes well, including additions, deletions, and type mismatches. However, I'm looking to improve how differences within arrays are displayed. Currently, if an item at the beginning of an array is modified or removed, all subsequent items are marked as changed, which isn't very helpful for quick analysis.
Here's where I could use your collective wisdom:
Visualization Techniques: Does anyone have suggestions for more intuitive ways to display array differences? Maybe a method that effectively pinpoints and isolates changes without cascading the entire array?
Code Feedback: I'd love to get some feedback on the implementation. I'm sure there are optimizations and best practices that I could apply to enhance the tool's performance and usability.
I'm looking forward to your insights and suggestions. Let's make JSON comparisons easier for everyone!
You can check out the tool and contribute here: https://github.com/phplego/jcmp
Thank you all in advance!
ยป npm install json-diff-kit