[jackson-user] Re: Custom mapper for conditional map serialization

2024-04-27 Thread Viktor Remennik
Thank you for your reply. Yep, my fault, it's just a mve, I actually receive an 'Object o' which I need to serialize, that's why i doubt i could annotate it as it is received from external source. I mean, i cannot annotate fields of this object and would like to avoid modifying it as it should

[jackson-user] Re: Custom mapper for conditional map serialization

2024-04-27 Thread Mantas Gridinas
See the polymorphic handling documentation https://github.com/FasterXML/jackson-annotations?tab=readme-ov-file#handling-polymorphic-types On Saturday, April 27, 2024 at 3:27:30 PM UTC Mantas Gridinas wrote: Is @JsonSerialize still around? You could annotate fields with that annotation and

[jackson-user] Re: Custom mapper for conditional map serialization

2024-04-27 Thread Mantas Gridinas
Is @JsonSerialize still around? You could annotate fields with that annotation and jackson would delegate serializing those fields to that particular serializer. But your code would remain largely the same - you'd still need to check what to write depending on the field. I suppose you could