当前位置:   article > 正文

解决JSON parse error: Cannot deserialize instance of `java.lang.Integer` out of VALUE_TRUE token; nest

json parse error: cannot deserialize instance of `java.lang.integer` out of

前端联调的时候,不小心出错了。

错误信息如下

  1. JSON parse error: Cannot deserialize instance of `java.lang.Integer`
  2. out of VALUE_TRUE token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException:
  3. Cannot deserialize instance of `java.lang.Integer`
  4. out of VALUE_TRUE token\n at [Source: (PushbackInputStream); line: 1, column: 1373]
  5. (through reference chain:

看了下问题,主要是字段命名惹的祸。

  1. @ApiModelProperty(value = "是否显示")
  2. private Integer isShow;

MVC在帮你转换为json格式的时候,默认会把is开头的属性,给你转成布尔型。

真不知道这是好事情还是坏事情。

知道问题了,就好办了,直接把类型改了,或者把字段名改了就可以了。

总结下

在数据库命名的时候,最好不要使用is开头来设置字段,有些第三方喜欢帮你做一些你想不到的便利的事情。例如上面的情况。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/305406
推荐阅读
相关标签
  

闽ICP备14008679号