This line of code gives a deprecation warning:
mapper.configure(JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS, true);
And this doesn't compile
mapper.configure(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS, true);
because JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS
not a subclass of any of the four Feature
types ObjectMapper
supports.
What is the correct was to enable this feature with Jackson 2.12?
There doesn't seem to be any API that accepts JacksonFeature
or JsonReadFeature
as parameter.
DeserializationConfig
accepts FormatFeature
as parameter but you can't change this property of ObjectMapper
after getting a new instance by calling withFeatures()
.
The only solutions seems to be to get the feature out of the JsonReadFeature
which is then no longer deprecated:
mapper.enable(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS.mappedFeature());
(note the method call at the end of the enum).