I am having a bean, where Map is being returned in response, and this bean is invoked via REST interface using RESTEasy.
The jackson library is using BeanSerializer(internally) rather than using MapSerializer while sending the response back.
so is there any annotation being used here for letting it know which serializer to use for the bean.
Thanks in advance.
Jackson BeanSerializer extends BeanSerializerBase that will serialize fields based on their types (defined by TypeSerializer) using JsonSerializer defined by SerializerProvider. And the SerializerProvider will use the MapSerializer for everything that will extends java.util.map.
So ... the jackson library use the MapSerializer to serialize maps ...
Anyway, you can use the @JsonSerialize annotation to manage how jackson will serialize the proprty, more info in the documentation : https://github.com/FasterXML/jackson-databind/wiki/Databind-Annotations
Regards,
Loïc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With