cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How spring maps JSON to Java object in Hybris.

Huskar
Participant
0 Likes
2,322

I know that JSON to Java object conversion can be achieved with 'com.fasterxml.jackson.databind.ObjectMapper'. But where this is happening as I wasn't able to find it in any of xml file?

I want to change parsing logic as this mapper is using SimpleDateFormat to convert string to date but I want to use my customer format.

Any suggestion how can I achieve this?

Accepted Solutions (0)

Answers (2)

Answers (2)

surziceanu
Explorer
0 Likes

In spring-mvc-config.xml there is a list of message-converters. On MappingJackson2HttpMessageConverter you can set a custom ObjectMapper and on that mapper you can set the date formatter.

100542E11
Explorer
0 Likes

In case you are using OCC (commercewebservices):
I guess You may use custom data mappers to convert the JSON to DTO. Please search For
"com.amaro.ecp.commercewebservices.mapping.mappers.CCPaymentInfoDataMapper"
Before that remove the mapping in dto-level-mapping-v2-spring.xml for that particular attribute. And define the mapping in your custom data mapper.

Huskar
Participant
0 Likes

you but my question is related to conversion that happen before controller. i.e. when we submit any form, we use @RequestBody to get that. So this form is already mapped to defined bean. So how can I modified this conversion?