-
-
Notifications
You must be signed in to change notification settings - Fork 796
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
Disable the Number to String automatic conversion #192
Comments
Custom deserializer registered for As to feature, that is a possibility. This feature request should actually go in: https://github.com/FasterXML/jackson-databind/issues/ because it is related to binding of data from streaming JSON API (this project) into POJOs. |
Thanks for your answer, I have created the issue 796 in jackson-databind submodule. I don't understand how to do it with the custom deserializer. Indeed, I see the content via JsonParser, but it is already seen as a String, well if I parse it as a int, I will see it at the int, but that will not help me. My point is to know what was the exact type in the JSON request. Is there any existing method that I am missing? Perhaps you can reply on the new issue and close that one. |
Thanks! |
By default, Jackson is converting numbers to strings. In most cases, that's fine. But not in my situation unfortunately. Is there a way to prevent that?
For example:
JSON
JAVA
It works just fine. But the thing is that I want this automatic boxing not enabled and got an exception instead. So the user is forced to use a String. I.e.
I don't think such a feature exist, I look on http://wiki.fasterxml.com/JacksonFeaturesGenerator and a bit everywhere like http://stackoverflow.com/questions/7806316/jackson-json-converts-integers-into-strings
I tried to create a custom deserializer, but it seems that the value is already converted as a string when I got to the deserializer, and I don't have the possibility to determine if it was a string or an integer originally in the request.
Thanks
Fabian
The text was updated successfully, but these errors were encountered: