Java Cannot deserialize instance of `xxx` out of START_ARRAY token问题解决
问题描述:
org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize instance of `java.lang.String` out of START_ARRAY token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_ARRAY token
at [Source: (PushbackInputStream); line: 1, column: 100] (through reference chain: com.dto.UserDto[“userId”])
问题分析:
1、后端接收参数类型是字符串,但是前端传参类型是数组,前端传参类型和后端参数类型不一致,导致报错。
解决办法:
前端传参类型改为字符串。
2、后端接收参数类型为List,但是前端传参类型为json,前端传参类型和后端参数类型不一致,导致报错。
解决办法:前端使用正确的数组传参格式即可。
[
"344152905613578240"
]
还没有评论,来说两句吧...