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
Cereal is expecting more than a single "Person" to be serialized, so it writes an outer json where it puts each of the serialized objects.
You can name each object using CEREAL_NVP direclty at archive(p); to overwrite the default keyname "value0".
Or for this toy example you could get no additional layers by manually serializing each field from outside: archive(cereal::make_nvp("name", p.name), cereal::make_nvp("age", p.age));... but not very escalable.
I believe Cereal is more for serializing the state of your app, preferably in binary archives but you have human readable for simple cases / debugging purposes. Is not really suited for loading/writing config files.
When I use cereal:
I expect to serialize to the string:
{ "name": "Alice", "age": 30 }
But the serialized string is:
cereal adds an additional layer to the top object, How do I use cereal to generate json with no additional layers?
The text was updated successfully, but these errors were encountered: