-
Serialization: Correctly encode structs with no fields · cdc19ac4Ben Clayton authored
Empty structs were being serialized as `null`, when they should have been serialized as `{}`. This was due to the type inference on the serializer - where no calls to `field()` would result in the default `null` type. To solve this, the `serialize(const void* object, const std::initializer_list<Field>&)` inline helper has been promoted to a virtual function (and renamed to `fields()`). The JSON serializer implementation of this now first sets the object type to `object`, even if there are no fields to serialize. Added test for this. Fixes: #10cdc19ac4
×