Skip to content
Advertisement

Jackson: Deserialize BigDecimal as plain String using annotation

I have this REST response:

JavaScript

And this POJO:

JavaScript

I’m using Spring RestTemplate with MappingJackson2HttpMessageConverter. With response above, prevValue is deserialized as a String like 1.0104401E7, in scientific notation.

I want it to be deserialized without scientific notation. Is there a way to do this using Jackson annotations?

Advertisement

Answer

You can use the @JsonFormat annotation:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement