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

Allow to save a report of the differences encountered #17

Open
vieirandre opened this issue May 25, 2018 · 12 comments
Open

Allow to save a report of the differences encountered #17

vieirandre opened this issue May 25, 2018 · 12 comments

Comments

@vieirandre
Copy link

Feature request. Self-explaining title.

Anyhow, congrats for the tool, @zgrossbart.

@zgrossbart
Copy link
Owner

Thanks for using JSONDiff. What would this report look like? What format would you want to save?

@vieirandre
Copy link
Author

For starters, I thought in a .pdf where you'd have the stats of differences at the top and the json below showing the inequalities inline.

@zgrossbart
Copy link
Owner

Thank you for the report. I could develop a print CSS that would allow you to do that. Then you could use the browser to print to CSS. The problem is that the differences would nee to be dynamic and I'm not sure how to make that work in a PDF. Let me think about this some more, but this is a lower priority feature.

@vieirandre
Copy link
Author

Just so we can get on the same page: what do you mean by “differences would need to be dynamic”?

I was thinking in the differences being displayed like Git's diff. That would be static.

@zgrossbart
Copy link
Owner

The diff from JSONDiff is different than a diff from Git. JSONDiff will show multiple differences on the same line and the information you will will change as you iterate through your list of differences.

Repository owner deleted a comment from fmalina Mar 26, 2019
@smitapaloalto
Copy link

Hello, can we store the output in a pdf or JSON file? We want to take this difference and create a list for the customers to check what has changed in our jsons in different releases.

@zgrossbart
Copy link
Owner

zgrossbart commented Jan 31, 2024

@smitapaloalto, generating a PDF file from a browser is a bit tricky. However, you can print to PDF and get a list of the differences between the two files. Right now the formatting on that PDF really isn't great, but I could develop a print CSS that would make it better. Would that give you the functionality you're looking for?

You can also take a look at our readme to see how you can create an URL where you can automatically load files to compare.

@arademaker
Copy link

but how to get the results as json? I would like to have the total number of differences and each of the differences as a list.

@zgrossbart
Copy link
Owner

@arademaker, Thank you for the suggestion. There's no way to save a report of the differences in JSON now.

Can you tell me a little more about your use case and what you'd like to see in the report. Are you looking to incorporate this into a CI process and you want to consume the JSON that way? Are you just looking for an easy way to save the results of multiple comparisons? Is it something else?

@arademaker
Copy link

I am using LLM to produce JSON outputs representing data extracted from texts. Since I have some golden data, I also want to evaluate the produced outputs. My code is in Python. Ideally, I would like to call JDD during a loop, passing the expected JSON and the JSON produced by the LLM to it to obtain a similarity score.

@arademaker
Copy link

If the code could be loaded as a NodeJS library, we could implement a more straightforward HTTP interface so the Python code could call it and get back the diff as a JSON.

@zgrossbart
Copy link
Owner

That use case makes sense. Thank you.

The way that JSONDiff is implemented right now depends on running in a browser. However, some people have done ports of JSONDiff to NodeJS. You can do a quick Google search to find them. They may fit your use case better.

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

4 participants