You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check to see if this issue has already been reported (quick glance at existing issues)
Include version information for Jackson version you use: jackson-databind-2.9.5
Currently Jackson deserializes {"myValue" : "true"} as Boolean which is not always desirable (because sometimes strict types are required: {"myValue" : true}).
Could you please introduce DeserializationFeature.ACCEPT_STRING_AS_BOOLEAN (simmilar to DeserializationFeature.ACCEPT_FLOAT_AS_INT), which will be enabled by default to cover backward compatibility, but can be disabled if not wanted.
Thank you in advance
The text was updated successfully, but these errors were encountered:
Thank you for your suggestion. The basic idea of allowing stricter handling makes sense.
However: there is already MapperFeature.ALLOW_COERCION_OF_SCALARS which I think should apply here. You can try to see if disabling it works for booleans: if not, it's a bug.
Looking at tests I think it should work (2.9.6), but let me know if you find otherwise.
Going forward I also hope to support existing property @JsonFormat(lenient = OptBoolean.FALSE) for wider range of types. As is, it is only supported by date/time types (JDK ones), but it seems to me it should work for primitives/wrappers at least as well.
you are right MapperFeature.ALLOW_COERCION_OF_SCALARS indeed works.
Shall I close this issue or let it open for @JsonFormat(lenient = OptBoolean.FALSE)?
jackson-databind-2.9.5
Currently Jackson deserializes
{"myValue" : "true"}
as Boolean which is not always desirable (because sometimes strict types are required:{"myValue" : true}
).Could you please introduce
DeserializationFeature.ACCEPT_STRING_AS_BOOLEAN
(simmilar toDeserializationFeature.ACCEPT_FLOAT_AS_INT
), which will be enabled by default to cover backward compatibility, but can be disabled if not wanted.Thank you in advance
The text was updated successfully, but these errors were encountered: