我们正在使用jackson,我在代码中看到了这一点
DeserializationConfig.Feature.USE_BIG_DECIMAL_FOR_FLOATS
DeserializationConfig.Feature.USE_BIG_INTEGER_FOR_INTS
但是如何让杰克逊现在使用这些功能?
这将是完美的情况。我只想要一个包含String,BigDecimal和BigIntegers的Map结果。
答案 0 :(得分:8)
Enable the feature on the ObjectMapper.
ObjectMapper mapper = new ObjectMapper();
mapper.enable(DeserializationConfig.Feature.…);
ObjectMapper mapper = new ObjectMapper();
mapper.enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS);
mapper.enable(DeserializationFeature.USE_BIG_INTEGER_FOR_INTS);