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

Pretty-printing JSON in IntelliJ diffs #749

Open
joshuajaharwood opened this issue Apr 11, 2024 · 2 comments
Open

Pretty-printing JSON in IntelliJ diffs #749

joshuajaharwood opened this issue Apr 11, 2024 · 2 comments

Comments

@joshuajaharwood
Copy link

Is your feature request related to a problem? Please describe.
When comparing two JSON strings when a difference is found (when you click in IntelliJ), they are printed without any whitespace which can make visual inspection harder.

Describe the solution you'd like
The ability to pretty-print both JSON strings for display in the IntelliJ differ would make visual comparison much easier.

Describe alternatives you've considered
None

Additional context
Tested on v2.38.0, Java 8.

@lukas-krecan
Copy link
Owner

lukas-krecan commented Apr 12, 2024

Duplicate of #44. I understand it would be a useful feature, but currently I do not have any capacity to implement it, sorry.

@lukas-krecan
Copy link
Owner

Hi @joshuajaharwood, I am currently looking into that. I am curious what would be your expectation, we can to the following

  1. Just normalize the JSONs, for example, order keys alphabetically and pretty print the JSONs. The donwside would be that the order of fields would change, is that acceptable?
  2. We can normalize the actual value based on expected. Instead of sorting fields alphabetically, we would make sure the order in the actual value is the same as in the expected one.
  3. We can put the differences to the top. Instead of sorting, we can start printing the JSON from the parts that are different. This may be useful for larger JSONs
  4. We can only print the parts that are different.
    What option would you prefer and why? Thank you

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