Unwrapping object in custom serializer #4637
Replies: 2 comments 1 reply
-
Get the serializer for the constant value from the context, then call unwrappingSerializer() on it to get a serializer that will just spit out the fields. |
Beta Was this translation helpful? Give feedback.
-
Yeah you cannot simply omit START_/END_OBJECT write: contract is such that by default So I am not sure this is achievable without custom parent serializer too. |
Beta Was this translation helpful? Give feedback.
-
Due to some various factors and the complicated class structure I have, I need to use custom serialization rather than the default annotation based approach. I was wondering if there's any guides or specific methods I'm missing in order to unwrap a value within the object context. For context, here's my code:
The problem arises on the
jsonGenerator.writeObject(...
line which works because I have wrapped the value by writing a field name but I was wondering, is it possible to unwrap that value and simply write the object within the value field name above?It currently results in:
but I would like
Is this possible in a custom serializer?
Beta Was this translation helpful? Give feedback.
All reactions