I have a class that sometimes I need to merge into...
# serialization
j
I have a class that sometimes I need to merge into another class when serializing. Is it possible to add a descriptor to another descriptor? Essentially merging the elements together?
d
Maybe but I'd need a concrete example.
j
Im just thinking of the case where i have two classes like Car and Driver. I have to emit json where the fields from Car and Driver are in the same structure. I wanted to avoid having to rewrite the serialization code for both by merging their serializers together
Another way to describe it perhaps would be, is there an easy way for me to merge a child object into my object (for serialization only). So that my json wouldn’t have a sub-object for that child object, the fields would just all be merged into one object