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

Diff two objects to create a patch #173

Open
tim-lyon opened this issue Jul 6, 2024 · 2 comments
Open

Diff two objects to create a patch #173

tim-lyon opened this issue Jul 6, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@tim-lyon
Copy link

tim-lyon commented Jul 6, 2024

Is your feature request related to a problem? Please describe.
I'd love to use yyjson on a project, but I need the ability to create patches from the diff of two JSON documents.
Currently I would need to use nlohmann/json specifically for this feature.
Thank you for your consideration 🙏

Describe the solution you'd like

yyjson_doc *patch = yyjson_diff(doc1, doc2);

Describe alternatives you've considered
https://json.nlohmann.me/api/basic_json/diff/

@ibireme
Copy link
Owner

ibireme commented Jul 7, 2024

Since the objects and arrays are stored as linear data structures, creating an efficient diff algorithm could be quite complex or potentially slow. I'll look into it when I have more time.

@ibireme ibireme added the enhancement New feature or request label Jul 7, 2024
@tim-lyon
Copy link
Author

tim-lyon commented Jul 7, 2024

Thanks @ibireme
For reference, the nlohmann implementation is only 130 LoC, and for my purpose at least, a similar implementation would be better than none. There are definitely opportunities for optimisation though.

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

No branches or pull requests

2 participants