Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Registering multiple Jackson Converters

I'm trying to configure a Jackson objectMapper to handle conversions from one Map-like DTO to an intermediate domain POJO, and from there to another Map-like DTO.

If I manually instantiate all the StdConverter<FromMap, POJO> and StdConverter<POJO, ToMap> it works as expected.

How can I configure the ObjectMapper with my custom converters?

like image 535
Eddy Avatar asked Oct 16 '25 23:10

Eddy


1 Answers

Seems that converters can be registered using the StdDelegatingSerializer as follows:

SimpleModule module = new SimpleModule()
    .addSerializer(String.class, new StdDelegatingSerializer(
        new Converters.StringToAttributeValue()))
like image 53
Eddy Avatar answered Oct 18 '25 13:10

Eddy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!