-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow case insensitive deserialization of String value into boolean
/Boolean
(esp for Excel)
#1852
Comments
Hmmh. Actually... it might be possible to enable this by making use of existing
on property, or as global default (for types I am mostly thinking of API here because I know that there are users who absolutely dislike allowing of non-standard variants (it is possible to disable coercion with |
I just ran into this today. My app allows exporting existing data to CSV, for the user to edit and re-upload with updates. When editing the exported CSV in Excel, Excel helpfully converts |
@bobbylight Thank you for the additional datapoint. This makes (more) sense. I wonder if this is something that could be further handled or helped at CSV decoder level... the challenge here is that in many cases decoder does not do additional type coercion. But at the same time, for some other formats such coercion might not be useful. One other idea I realized is that |
Configuration of Jackson is still a little voodoo to me, so I definitely trust your judgment on how best to address this. 😀 But in the mean time, what is the simplest workaround for my project? Do I have to write a deserializer for my pojo type containing boolean fields, or is there an easier way? |
Yes, custom deserializer is probably the way to go at this point. Or, if you have control over POJO in question, setter that either takes |
I've sent a PR for the issue: #2132 |
Ended up re-thinking this and simple also allowing "TRUE" and "FALSE" at this point. Some further thoughts:
|
boolean
/Boolean
(esp for Excel)
FasterXML/jackson-databind#1852 shipped in 2.12.0 allows case-insensitive boolean deserialization
FasterXML/jackson-databind#1852 shipped in 2.12.0 allows case-insensitive boolean deserialization
FasterXML/jackson-databind#1852 shipped in 2.12.0 allows case-insensitive boolean deserialization
FasterXML/jackson-databind#1852 shipped in 2.12.0 allows case-insensitive boolean deserialization
FasterXML/jackson-databind#1852 shipped in 2.12.0 allows case-insensitive boolean deserialization
FasterXML/jackson-databind#1852 shipped in 2.12.0 allows case-insensitive boolean deserialization
At the moment,
com.fasterxml.jackson.databind.deser.std.NumberDeserializers.BooleanDeserializer#_parseBoolean
support only"true"
and"True"
(and the same for false) but fails for values like"TRUE"
It would be great to do the matching case insensitive out of the box (similar to howjava.lang.Boolean#parseBoolean
checks for true)The text was updated successfully, but these errors were encountered: