Bug#888112: diffoscope: compare JSON files using Python jsondiff module

Paul Wise pabs at debian.org
Tue Jan 23 13:41:18 UTC 2018


Package: diffoscope
Version: 90
Severity: wishlist

The Python jsondiff module allows comparing JSON files in a better way
than just comparing the plain text like diffoscope currently does.

The jsondiff command-line program outputs only the JSON attributes that
are different between the files, but the Python module probably allows
more advanced analyses.

If jsondiff doesn't prove useful or is hard to use, please pretty-print 
JSON files by loading the JSON file into a Python object and call
json.dump() with the indent=4 parameter and then diff the text.

$ curl -s 'https://salsa.debian.org/api/v4/users/1' > 1
$ curl -s 'https://salsa.debian.org/api/v4/users/2' > 2
$ diffoscope 1 2
--- 1
+++ 2
@@ -1 +1 @@
-{"id":1,"name":"Administrator","username":"root","state":"active","avatar_url":"https://seccdn.libravatar.org/avatar/9a5dac7fca5fa69fcb4fa36b948ff766?s=80&d=identicon","web_url":"https://salsa.debian.org/root","created_at":"2017-12-17T12:04:05.482Z","bio":"","location":"","skype":"","linkedin":"","twitter":"","website_url":"","organization":""}
+{"id":2,"name":"Paul Martin","username":"pm","state":"active","avatar_url":"https://seccdn.libravatar.org/avatar/a0177f306e580e136af48558989f2782?s=80&d=identicon","web_url":"https://salsa.debian.org/pm","created_at":"2017-12-17T12:46:16.992Z","bio":null,"location":null,"skype":"","linkedin":"","twitter":"","website_url":"","organization":null}
$ jsondiff 1 2 ; echo
{"id": 2, "name": "Paul Martin", "username": "pm", "avatar_url": "https://seccdn.libravatar.org/avatar/a0177f306e580e136af48558989f2782?s=80&d=identicon", "web_url": "https://salsa.debian.org/pm", "created_at": "2017-12-17T12:46:16.992Z", "bio": null, "location": null, "organization": null}

-- 
bye,
pabs

https://wiki.debian.org/PaulWise
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.alioth.debian.org/pipermail/reproducible-builds/attachments/20180123/68e5cfed/attachment.sig>


More information about the Reproducible-builds mailing list