Closed chad-earthscope closed 1 year ago
Implementing the full JSON Patch requires a lot of work... I’ll try to implement #84 soon, which looks easier.
The new functions have been added to the master branch.
Excellent, thank you!
Just a note to say that I'm now using these new functions and they are all working great. Thank you!
Thank you for this excellent library!
I am implementing functionality to create or replace a value specified using a JSON Pointer in an existing
yyjson_mut_doc
and would appreciate knowing if I've missed discovering some functionality that addresses this.Initially I thought the merge patch functionality was a good fit. But my understanding is using merge patch for this would require reallocating the document each call, which is not ideal in terms of efficiency.
Next I considered
yyjson_mut_obj_replace()
(and arr version), and other approaches but these all require a fair bit of code to discover the path that exists, create path that is needed, and then replace or create the final value.What I have wished for is an interface like:
w/ convenience wrappers
which create the path context as needed and then create or replace the final value. Edit: and remove/free any structures that are removed.
Any hints would be appreciated. It is entirely possible I've missed some functionality that would accomplish this.
This functionality would be satisfy the functionality described here I believe: https://github.com/ibireme/yyjson/issues/84
and likely address many of the setting usage cases of JSON Patch: https://github.com/ibireme/yyjson/pull/12