benjamine / jsondiffpatch

Diff & patch JavaScript objects
MIT License
4.86k stars 472 forks source link

how to find which json file the diff is coming from #362

Open smitapaloalto opened 9 months ago

smitapaloalto commented 9 months ago

Hi,

I am calling 'jsondiffpatch json1.json json2.json' as a subprocess and storing the output with my Python script.

I am required to create a changelog using the diff file. How can I find out if it's an item added or removed and also which file has this change? Currently, the diff file shows the changes, I need to find where the diff is from, i.e if it is removed or added item from json1 or json2. Please guide me further.

Also, can you tell me how to create a readable JSON file with the subprocess output of this command?

Ex:

Json1 {.
a: 20 }

Json2 { a: 25 b :30 }

diff file shows a: 20 =>25 I am looking for a solution that shows-

json1(20) => json2(25) Json2(added 30)