Disable the Number to String automatic conversion in jackson

倖福魔咒の 提交于 2021-01-20 12:30:29

问题


When I make a json request to a spring boot backend, Jackson is automatically converting numbers to strings. Is there a way to prevent that?

For example:

JSON

{
    "numberAsString": 123
}

JAVA

private String numberAsString;

after binding json value to the java field numberAsString is equal to "123". i need to prevent this automatic conversion and need to throw some kind of a exception when this happens.

来源:https://stackoverflow.com/questions/56678885/disable-the-number-to-string-automatic-conversion-in-jackson

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!