Hi All,
As a developer I have to compare multiple large JSON strings a lot of time while debugging or comparing API responses between different versions. Although there is a galaxy of json comparison tools out there, most of them either copy of each other or half baked solutions. Some of the famous ones even are not correct (*cough cough*hypertest*cough*). Most of them are filled with ads.
Thinking from first principles and design thinking, I created the best JSON comparison web app to help every developer and QA person.
Here are some of the things that stand out -
Dynamic comparison as you type/import JSON. You don't get stuck in read only mode post comparison. Keep editing/fixing while it dynamically calculates the diff.
Import multiple files or drag and drop json files into the editor.
Shows JSONPath of the value where your cursor is (separately in both editors!) Helps you keep track of where you are in large JSONs
Lets you jump to specific diff from the list or navigate using next/prev diff button
Is fast even with large JSON files
Set keybindings like VScode or Sublime text with your editor.
Others - ad free, download json (with custom name), swap left and right, ignore case, secure (all processing on client), compare multiple files on the same page by adding new "tools"
If you are a dev/QA/product person who needs to work with JSON, please try https://jsontoolbox.com/compare once and let me know your feedback.
I have two json files that contain the output of an api call to a report in our property management software from two different days. I want to see which items were added to and removed from the second file compared to the first. each file is about 100,000 lines. I tried using diff, and that does work, but It's really hard to read given the large number of differences. Is their a better or easier tool for this?
If your shell supports process substitution (Bash-style follows, see docs):
diff <(jq --sort-keys . A.json) <(jq --sort-keys . B.json)
Objects key order will be ignored, but array order will still matter. It is possible to work-around that, if desired, by sorting array values in some other way, or making them set-like (e.g. ["foo", "bar"] โ {"foo": null, "bar": null}; this will also remove duplicates).
Alternatively, substitute diff for some other comparator, e.g. cmp, colordiff, or vimdiff, depending on your needs. If all you want is a yes or no answer, consider using cmp and passing --compact-output to jq to not format the output for a potential small performance increase.
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