Skip to content

More human readable diff views #529

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

Open
mauvilsa opened this issue Mar 18, 2025 · 4 comments · May be fixed by #549
Open

More human readable diff views #529

mauvilsa opened this issue Mar 18, 2025 · 4 comments · May be fixed by #549

Comments

@mauvilsa
Copy link

Is your feature request related to a problem? Please describe.
deepdiff is particularly useful for big jsons with possibly complex nested structures. However, the diff output is mostly suitable for machines, not humans. There is the "pretty" view (#187), but that just makes each difference into a sentence, which is not that useful in practice. In particular, in many use cases, for a diff to be useful, the context is very important.

Describe the solution you'd like
Add two more views:

  1. Similar to the standard diff --context=<lines>, where small parts of the json are shown, one for each difference but including the surrounding context. Could be number of lines above and below the difference, or the context be more json specific.
  2. Similar to dwdiff -c, where the entire json is shown mostly in white font, but in places where there are differences, show deletions in red and additions in green.

Describe alternatives you've considered
Implement myself something on top of deepdiff to get the views that I want. The downside is that this would only benefit me, even though it is something general which many people could benefit from.

Additional context

@mauvilsa
Copy link
Author

I might work on this kind human readable of views. But, it would be nice to get some feedback here. That is, to know whether contributing such a feature here would be welcome.

@seperman
Copy link
Owner

seperman commented May 9, 2025

Hi @mauvilsa
Have you looked at the pretty command?
https://zepworks.com/deepdiff/current/view.html#pretty-method

@mauvilsa
Copy link
Author

mauvilsa commented May 9, 2025

@seperman yes I am aware of pretty as mentioned above. From what I know, the current pretty view doesn't show the context of where there are changes, which is what I am interested in.

@seperman
Copy link
Owner

seperman commented May 9, 2025

@mauvilsa Ah I see. So you want to use DeepDiff's output to use color to show the pieces in the data that have changed, added or removed. That's a very cool idea! Yes, such a feature will be very useful. :)

@mauvilsa mauvilsa linked a pull request May 16, 2025 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants