json-difference icon indicating copy to clipboard operation
json-difference copied to clipboard

Optional output in JSON Patch format?

Open bmaranville opened this issue 2 years ago • 3 comments

Would you consider optionally providing the diff in a format compatible with JSON Patch (RFC 6902) ?

bmaranville avatar Oct 05 '22 15:10 bmaranville

Hey @bmaranville,

It's a very interesting format, I almost followed something similar at first, but the difficulty of interpreting "move" made me not follow. And the understanding of having a result that could be minimalistic for database storage also helped to shape the json-diffrence lib.

What is a "moved" value? The union of two operations in the context of diff between two structures?

1- Op. remove 2- Op. add

And what if there are repeated values?

I didn't know this RFC, I really liked the proposal, I need to read it calmly.

But what would be your idea, 100% support for this RFC or basically followed the same output idea offered by "json-difference" but following RFC 6962 format?

lukascivil avatar Oct 08 '22 23:10 lukascivil

Thanks for looking into it! I was more interested in the latter: providing the same outputs, but in a format compatible with the spec. In my use case I would be diffing and patching, so having a standard intermediate patch object gives the most flexibility.

bmaranville avatar Nov 03 '22 11:11 bmaranville

I think this PR will open some doors for us here. https://github.com/lukascivil/json-difference/pull/40 and https://github.com/lukascivil/json-difference/pull/43

lukascivil avatar Jul 23 '23 01:07 lukascivil