Skip to content

Instantly share code, notes, and snippets.

View oscherler's full-sized avatar

Olivier Scherler oscherler

View GitHub Profile
@oscherler
oscherler / README.md
Last active July 3, 2024 00:18
Diff JSON in Git using gron

jsondiff: diff JSON in Git using gron

gron is an incredible tool that makes JSON greppable. But it also makes it diffable, which is great if you have JSON files in Git.

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. Then try it:

git init
echo '{"foo":42,"bar":"hello"}' > foo.json
git add foo.json && git commit -m 'Initial commit.'