gumtree icon indicating copy to clipboard operation
gumtree copied to clipboard

how to diff JSON files with Gumtree?

Open monperrus opened this issue 3 years ago • 4 comments

Hi @jrfaller

how to diff JSON files with Gumtree?

Thanks,

monperrus avatar Mar 10 '22 08:03 monperrus

Hi @monperrus,

Currently it's not possible.

We have a JSON differ compliant with the RFC Json patch here : https://github.com/caohanyang/json_diff_rfc6902 (beware it's not maintained anymore).

Also there is a tree sitter grammar (https://github.com/tree-sitter/tree-sitter-json) that could be integrated easily into GumTree.

Cheers!

jrfaller avatar Mar 10 '22 09:03 jrfaller

Ack, thanks @jrfaller

FTR, we look into https://github.com/gnieh/diffson by @satabin

cc/ @algomaster99 @khaes-kth FYI

monperrus avatar Mar 10 '22 10:03 monperrus

OK don't hesitate to tell me how it works with diffson, AFAIK it seems to be using sequence algorithms (LCS, Patience)?

FYI we have a small benchmark in our publication on the subject: https://hal.archives-ouvertes.fr/hal-01433078/document

Cheers!

jrfaller avatar Mar 10 '22 12:03 jrfaller

Hi @jrfaller, it does use LCS based diff for arrays, and does not generate patches with move action. I was investigating other algorithms a while ago but haven’t looked into it for a while. I will have a look at JDR, it sounds interesting.

satabin avatar Mar 10 '22 13:03 satabin