Unmarshal JSON for String, BigInteger and BigDecimal with Jackson is very close

We use jackson and I see this in code

DeserializationConfig.Feature.USE_BIG_DECIMAL_FOR_FLOATS
DeserializationConfig.Feature.USE_BIG_INTEGER_FOR_INTS

But how do I get jackson to use these features now?

That would be an ideal situation. I just need the Map result with String, BigDecimal and BigIntegers.

+5
source share
1 answer

Include this feature in ObjectMapper.

ObjectMapper mapper = new ObjectMapper();
mapper.enable(DeserializationConfig.Feature.…);

Update for version> = 2.0.0:

ObjectMapper mapper = new ObjectMapper();
mapper.enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS);
mapper.enable(DeserializationFeature.USE_BIG_INTEGER_FOR_INTS);
+8
source

All Articles