Skip to content

Instantly share code, notes, and snippets.

@ipan
Created January 16, 2018 04:47
Show Gist options
  • Save ipan/e5e86d5495f16216e31fe12ebc9532a4 to your computer and use it in GitHub Desktop.
Save ipan/e5e86d5495f16216e31fe12ebc9532a4 to your computer and use it in GitHub Desktop.
compare two JSONs with jq #json #jq
@delrioe
Copy link

delrioe commented Mar 2, 2021

You can use: diff <(jq 'keys' file1.json) <(jq 'keys' file2.json)
This will just give you the list of keys that are different.

@briner
Copy link

briner commented Feb 8, 2022

I've been using you command. But it seems that it does not fully order all the json. I've found this blog. It tells us to use a filter walk.filter which is documented in the blog. And then you have a sorted json with jq -S -f walk.filter file1.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment