-
-
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
The method _parseInteger of StdDeserializer #664
Comments
Just to make sure I understand: you would NOT want a floating point number (like |
Sorry, I didn't say it clearly. first: I have a class Second, there is a json Third: data conversion the result is successful and I get the site, the value of site type is 1,but I don't think so, |
Different users want different things: many prefer to try very hard to match data; and since (for example) floating point numbers are still numbers, rounding to closest or truncating may make sense in cases where there is mismatch. So if your specific desire is NOT to allow coercion of floating point numbers to integer numbers, it would make sense to have a new It sounds like this is what you want, then. I don't know when I'll have a chance to work on it, but it will probably not make it in 2.5 yet, but 2.6. |
@cowtowncoder Thanks! |
Added |
Just noticed this crazy behaviour... no words! Having DeserializationFeature.ACCEPT_FLOAT_AS_INT = true as default is simply insane. Truncating a float means loosing information, so it MUST NOT be the default. |
@Skarafaz you have right to voice your opinion. And I am free to disregard it. |
The method _parseInteger of StdDeserializer auto handle JsonToken.VALUE_NUMBER_FLOAT to JsonToken.VALUE_NUMBER_INT,could you support enum to prohibit this feature?
_parseShort、_parseIntPrimitive and so on.
The text was updated successfully, but these errors were encountered: