Open edunad opened 4 months ago
Glaze is focused on doing as much work at compile time as possible (for performance). Would a glz::diff
on two separate structs, which produces a new object that we can read into to produce your patched JSON work? Or, does this diff
need to occur at runtime for you?
In other words, do you know the layout (fields and types) of json1
and json2
at compile time? If so, we can make this diff
reading/writing much more efficient.
Glaze is focused on doing as much work at compile time as possible (for performance). Would a
glz::diff
on two separate structs, which produces a new object that we can read into to produce your patched JSON work? Or, does thisdiff
need to occur at runtime for you?In other words, do you know the layout (fields and types) of
json1
andjson2
at compile time? If so, we can make thisdiff
reading/writing much more efficient.
It would be great if both cases where supported, at the moment i use diff
and patch
for migrating user settings version (by using json_t), but i could make it so the app using the lib implements a settings struct 🤔, if it would allow json1 to have a structure and json2 to have a slightly different structure.
I also have plans of allowing lua
scripting users to define their own settings (for modding), and that one i won't be able to predict the structure
Thanks for your additional explanation and thoughts. I like this idea and think it should be added, but it won't be a priority at the moment so I can't give you a date for the feature yet.
Thanks for your additional explanation and thoughts. I like this idea and think it should be added, but it won't be a priority at the moment so I can't give you a date for the feature yet.
No worries :D, am already implementing something on the side (not great but it works), thanks again for the amazing lib ^^
Awesome lib so far :D, i'm currently migrating from nlohmann json and i was wondering if there are plans on implementing a
diff
&patch
method? I tried looking around andmerge
seems to be the closest topatch
, i'm currently implementing it on my lib, but would be nice to have glaze do itAka:
...later on..
patchedJSON contains data kept the non-removed / replaced data from the prev json and added / removed data from json2, kinda like a migration.
Similar to https://json.nlohmann.me/api/basic_json/diff/