You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The parser could use yyjson_val, but yyjson_merge_patch returns yyjson_mut_val;
It's inefficient to parse the structure to the yyjson_doc object just for filling missing fields.
The problem could be solved by ourselves by implementing the whole writer and reader, but the author could do it much more elegant. The first issue could be solved by yyjson_mut_doc_imut_copy as well, but again, such simple stuff like changing field inside an existing object shouldn't be such complicated and slow.
The text was updated successfully, but these errors were encountered:
Overview
Sometimes it's necessary to update the existing structure using JSON, which doesn't contain all the fields, but modified:
I hope the idea is clear.
Example
We can try to make our own
read
andwrite
methods like that:But there are 2 problems:
yyjson_val
, butyyjson_merge_patch
returnsyyjson_mut_val
;The problem could be solved by ourselves by implementing the whole writer and reader, but the author could do it much more elegant. The first issue could be solved by
yyjson_mut_doc_imut_copy
as well, but again, such simple stuff like changing field inside an existing object shouldn't be such complicated and slow.The text was updated successfully, but these errors were encountered: