Cheers for making this a local tool. So many versions of this sort of tool are online-only, which is a non-starter for proprietary data.
My diff tool, diff.so, is a web app, but it doesn’t send the text to the server (unless you publish). I wish there were a technical mechanism that could guarantee and enforce that, and certify it to users.
Graphtage: A semantic diff utility for JSON, HTML, YAML, CSV, etc
21–30 of 52 posts
Re: Graphtage: A semantic diff utility for JSON, HTML, YAML, CSV, etc
#22Earlier quoted context omitted.
My diff tool, diff.so, is a web app, but it doesn’t send the text to the server (unless you publish). I wish there were a technical mechanism that could guarantee and enforce that, and certify it to users.
You could distribute it as a single index.html file, with unobfuscated/unminimized vanilla javascript. The user could then execute it offline no problem.
Re: Graphtage: A semantic diff utility for JSON, HTML, YAML, CSV, etc
#23Re: Graphtage: A semantic diff utility for JSON, HTML, YAML, CSV, etc
#24Earlier quoted context omitted.
My diff tool, diff.so, is a web app, but it doesn’t send the text to the server (unless you publish). I wish there were a technical mechanism that could guarantee and enforce that, and certify it to users.
You could distribute it as a single index.html file, with unobfuscated/unminimized vanilla javascript. The user could then execute it offline no problem.
Re: Graphtage: A semantic diff utility for JSON, HTML, YAML, CSV, etc
#25Re: Graphtage: A semantic diff utility for JSON, HTML, YAML, CSV, etc
#26https://gist.github.com/jrockway/73982949b3d2ce9b443528042c4...
My program runs in less than 10 milliseconds (/usr/bin/time reports 0.00 seconds), and graphtage takes 5 minutes and 17 seconds. I'm 317,000x faster! (Not including the time to write the program; if you do that, then it's about even assuming graphtage took 0 seconds to write.)
Graphtage prints the entire file in JQ colors, with diffs inside fields colored red and green, which I love:
...
"hostIP": "10.136.13̟9̟2̶1̶.139̟1̶",
"podIP": "10.244.1.18̟6̟7̶",
...
(My terminal can't display the dots under the numbers and the strikethrough, but it looks great on HN! I really love it.)My program produces relatively boring line-by-line diffs:
- "hostIP": string("10.136.121.131"),
+ "hostIP": string("10.136.139.139"),
"phase": string("Running"),
- "podIP": string("10.244.1.17"),
+ "podIP": string("10.244.1.186"),
Honestly, I get what I want out of mine, and wait 317,000x less time, so... I probably won't be using this on a daily basis. But I will be stealing those dots and Unicode strikethroughs.Re: Graphtage: A semantic diff utility for JSON, HTML, YAML, CSV, etc
#27It's cool, but does seem quite slow. I'm diffing two 45kB CSVs on a fast computer and after 10 minutes I'm still at: Diffing: 0% ... 0/93195 [00:00
Have you tried -l or -k?
Re: Graphtage: A semantic diff utility for JSON, HTML, YAML, CSV, etc
#28Re: Graphtage: A semantic diff utility for JSON, HTML, YAML, CSV, etc
#29This is neat. I decided to diff two pods in a replicated Kubernetes service. It seemed that it was going to take forever to run, so I just wrote a short Go program to do the same thing (load two JSON files into a map[string]interface{}, cmp.Diff them) while it was going: https://gist.github.com/jrockway/73982949b3d2ce9b443528042c4... My program runs in less than 10 milliseconds (/usr/bin/time reports 0.00 seconds), a…
Re: Graphtage: A semantic diff utility for JSON, HTML, YAML, CSV, etc
#30This is neat. I decided to diff two pods in a replicated Kubernetes service. It seemed that it was going to take forever to run, so I just wrote a short Go program to do the same thing (load two JSON files into a map[string]interface{}, cmp.Diff them) while it was going: https://gist.github.com/jrockway/73982949b3d2ce9b443528042c4... My program runs in less than 10 milliseconds (/usr/bin/time reports 0.00 seconds), a…
Usecases might be a little bit different, but please allow me to share my solution.
The problem with diffing JSON and yaml is, that these formats aren't line based and hashes don't need to be ordered. But there is gron to turn json into a greppable line-based format [1]. Then you can sort. The sorted output is possible to diff now and then you can color the diff output with delta or a similar tool [2].
diff -u
This output provides a lot of context for me to see and understand the differences.[1] gron https://github.com/tomnomnom/gron
[2] delta https://github.com/dandavison/delta