Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
smitapaloalto opened this issue Feb 23, 2024 · 1 comment
Closed

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

smitapaloalto opened this issue Feb 23, 2024 · 1 comment

Comments

@smitapaloalto
Copy link

smitapaloalto commented Feb 23, 2024

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)

@benjamine
Copy link
Owner

@smitapaloalto I think you might be running this on a a terminal without coloring enabled?

as the way to distinguish that is thru font color, see this example

Image

now, for what you're trying to do, I wouldn't use the console diff CLI, I think you want to store the JSON diffs, the CLI doesn't provide that currently, you would need to call the library programmatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants