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.

Answer from Erik on Stack Overflow
🌐
GitHub
github.com › jlevy › pdiffjson
GitHub - jlevy/pdiffjson: View and diff JSON the easy way
Use brew install jq colordiff on Mac, apt-get install jq colordiff or equivalent on Linux. Install the script anywhere you like. Simplest: ... Or copy pjson and pdiffjson to /usr/local/bin by hand! $ pdiffjson Usage: pdiffjson [--sort-arrays] [diff options] file1.json file2.json Show pretty-printed, colored diff of normalized JSON.
Starred by 77 users
Forked by 6 users
Languages   Shell 100.0% | Shell 100.0%
🌐
GitHub
github.com › josephburnett › jd
GitHub - josephburnett/jd: JSON diff and patch · GitHub
Usage: jd [OPTION]... FILE1 [FILE2] Diff and patch JSON files. Prints the diff of FILE1 and FILE2 to STDOUT. When FILE2 is omitted the second input is read from STDIN. When patching (-p) FILE1 is a diff. Options: -color Print color diff. -p Apply patch FILE1 to FILE2 or STDIN.
Starred by 2.2K users
Forked by 65 users
Languages   Go 97.7% | Makefile 1.2%
🌐
GitHub
github.com › andreyvit › json-diff
GitHub - andreyvit/json-diff: Structural diff for JSON files · GitHub
% json-diff --help Usage: json-diff [-vCjfonskKp] first.json second.json Arguments: <first.json> Old file <second.json> New file General options: -v, --verbose Output progress info -C, --[no-]color Colored output -j, --raw-json Display raw JSON encoding of the diff -f, --full Include the equal sections of the document, not just the deltas --max-elisions COUNT Max number of ...s to show in a row in "deltas" mode (before collapsing them) -o, --output-keys KEYS Always print this comma separated keys, with their value, if they are part of an object with any diff -x, --exclude-keys KEYS Exclude these comma separated keys from comparison on both files -n, --output-new-only Output only the updated and new key/value pairs (without marking them as such).
Starred by 1.2K users
Forked by 138 users
Languages   CoffeeScript 66.6% | JavaScript 33.4%
🌐
GitHub
github.com › espadrine › json-diff
GitHub - espadrine/json-diff: Compute the difference between two JSON-serializable Ruby objects. · GitHub
gem install json-diff # On Linux, you may need to use sudo json-diff before.json after.json
Starred by 80 users
Forked by 10 users
Languages   Ruby 99.6% | Makefile 0.4%
🌐
GitHub
gist.github.com › ipan › e5e86d5495f16216e31fe12ebc9532a4
compare two JSONs with jq #json #jq · GitHub
You can use: diff <(jq 'keys' file1.json) <(jq 'keys' file2.json) This will just give you the list of keys that are different.
🌐
JSON Diff
jsondiff.com
JSON Diff - The semantic JSON compare tool
Validate, format, and compare two JSON documents. See the differences between the objects instead of just the new lines and mixed up properties.
🌐
GitHub
github.com › jclulow › jsondiff
GitHub - jclulow/jsondiff: A simple command-line JSON diff utility
A simple command-line JSON diff utility. Contribute to jclulow/jsondiff development by creating an account on GitHub.
Starred by 62 users
Forked by 14 users
Languages   JavaScript 100.0% | JavaScript 100.0%
🌐
GitHub
github.com › coozoo › qtjsondiff
GitHub - coozoo/qtjsondiff: Some kind of json diff widget that consists of two json viewer widgets with highlighting of jsons. There is two modes to view: json and text, search text inside json. Use different sources of json file, url or simply copy-paste. And some more features....
- copy text into clipboard: * **Copy Row** - item text "Name Type Value" separated by tab; * **Copy Rows** - all items text separated by tab (tabs allow spreadsheet paste); * **Copy Path** - path to the item in such format "name(type)->name(type)" For example: root(Object)->widget(Object)->image(Object)->alignment(String); * **Copy Path** - path path in jq style" For example: .AppConfiguration.sportToBeDisplayedByDefault[1].body; * **Copy Plain Json** - copy full plain text JSON (not formatted); * **Copy Pretty Json** - copy full pretty print JSON; * **Copy Selected Json Value** - copy value, array or object. ... Debian, Ubuntu and some other Linux distros may try precompiled and packed packages by linuxdeployqt available on releases page to use them don't forget install fuse system and make downloaded file executable.
Starred by 34 users
Forked by 11 users
Languages   C++ 96.6% | Shell 2.3% | QMake 1.1% | C++ 96.6% | Shell 2.3% | QMake 1.1%
Find elsewhere
🌐
GitHub
gist.github.com › oscherler › 22eb60eb78a4e4e89e0506578e8b820a
Diff JSON in Git using gron · GitHub
To use gron to diff JSON in Git, save the json-diff script below and make it executable. Then add a difftool as shown in gitconfig, and optionally create an alias to invoke it more easily.
🌐
GitHub
github.com › wI2L › jsondiff
GitHub - wI2L/jsondiff: Compute the diff between two JSON documents as a series of JSON Patch (RFC6902) operations · GitHub
The LCS() option instruct the diff generator to compute the Longest common subsequence of the source and target arrays, and use it to generate a list of operations that is more succinct and more faithfully represents the differences. ... This option is experimental and might be revised in the future. The Ignores() option allows to exclude one or more JSON fields/values from the generated diff.
Starred by 622 users
Forked by 42 users
Languages   Go 99.4% | Shell 0.6%
🌐
AppImages
appimage.github.io › Qt_JSON_diff
Qt JSON diff – AppImages
AppImage applications for Linux without installation ... Qt_JSON_diff is available as an AppImage which means "one app = one file", which you can download and run on your Linux system while you don't need a package manager and nothing gets changed in your system.
🌐
SourceForge
sourceforge.net › projects › json-diff.mirror
JSON-Diff download | SourceForge.net
August 22, 2025 - This is an exact mirror of the JSON-Diff project, hosted at https://github.com/andreyvit/json-diff.
🌐
GitHub
github.com › lukascivil › json-difference
GitHub - lukascivil/json-difference: A simple way to find the difference between two objects or json diff · GitHub
A simple way to find the difference between two objects or json diff - lukascivil/json-difference
Starred by 57 users
Forked by 5 users
Languages   TypeScript 91.8% | JavaScript 7.3% | HTML 0.9%
🌐
GitHub
github.com › homeport › dyff
GitHub - homeport/dyff: /ˈdʏf/ - diff tool for YAML files, and sometimes JSON · GitHub
A diff tool for YAML files, and sometimes JSON.
Starred by 1.7K users
Forked by 94 users
Languages   Go 97.7% | Shell 1.6% | Makefile 0.7%
🌐
GitHub
github.com › xlwings › jsondiff
GitHub - xlwings/jsondiff: Diff JSON and JSON-like structures in Python · GitHub
>>> d = diff({'a': 1, 'delete': 2}, {'b': 3, 'delete': 4}) >>> d {'delete': 4, 'b': 3, delete: ['a']} >>> d[jd.delete] ['a'] >>> d['delete'] 4 # Alternatively, you can use marshal=True to get back strings with a leading $ >>> diff({'a': 1, 'delete': 2}, {'b': 3, 'delete': 4}, marshal=True) {'delete': 4, 'b': 3, '$delete': ['a']} ... jdiff [-h] [-p] [-s {compact,symmetric,explicit}] [-i INDENT] [-f {json,yaml}] first second positional arguments: first second optional arguments: -h, --help show this help message and exit -p, --patch -s {compact,symmetric,explicit}, --syntax {compact,symmetric,explicit} Diff syntax controls how differences are rendered (default: compact) -i INDENT, --indent INDENT Number of spaces to indent.
Starred by 746 users
Forked by 89 users
Languages   Python
🌐
GitHub
github.com › nsf › jsondiff
GitHub - nsf/jsondiff: JsonDiff library
The lib can compare two json items and return a detailed report of the comparison. At the moment it can detect a couple of types of differences:
Starred by 227 users
Forked by 49 users
Languages   Go 100.0% | Go 100.0%
🌐
Commandlinefu
commandlinefu.com › commands › view › 24262 › get-a-diff-of-two-json-arrays
Get a diff of two json arrays Using diff
October 11, 2018 - Get a diff of two json arrays diff <(jq . -M -S < old.json) <(jq . -M -S < new.json) jq is amazing for manipulating json on the commandline, but the developers have some weird ideas about how to handle shell redirections. This command works around them. Further reading: https://github.com/...