jsondiffpatch icon indicating copy to clipboard operation
jsondiffpatch copied to clipboard

Is there any way to return a JSON difference object instead of delta alone?

Open brydko opened this issue 8 years ago • 1 comments

Hello. I would like to obtain an actual difference between 2 JSON with same schema.

JSON1 ->

{"key1":[{"prop1":"a","name":"a","status":"active","values":["val1"]}],
 "key2":[{"property":"oneProperty","name":"name","type":"someType"},
{"property":"differentProperty","name":"someOtherName","type":"someOtherType"},]};

JSON2 ->

{"key1":[{"prop1":"a","name":"a","status":"active","values":["val1"]}],
 "key2":[{"property":"oneProperty","name":"name","type":"someType"}]};

Delta is correctly obtained ->

 {"key2":{"_t":"a","_1":[{"property":"differentProperty","name":"someOtherName","type":"someOtherType"},0,0]}}

What I am actually trying to get is the actual difference itself (I don't care if some property was added or deleted). So the result I'm expecting is

{"key2":[{"property":"differentProperty","name":"someOtherName","type":"someOtherType"}]}

Is there any way to obtain it straight away or I should rather parse the delta ?

If this may be achieved using formatters, then which one is the way to go ?

Thank you

brydko avatar Jul 03 '17 10:07 brydko

Save issue

massmediagroup-28 avatar Mar 03 '18 09:03 massmediagroup-28