接口
@PostMapping("/aa")
public String setDoubtList(@RequestBody List<user> userList){
//接收一个list<user>,
return userService.setUserList(userlist);
}
测试接口时传入body内容
{
"user":[
{
"name":"aa",
"sex":"男",
"age":"14"
},
{
"name":"ba",
"sex":"女",
"age":"24"
},
{
"name":"za",
"sex":"男",
"age":"13"
},
]
}
JSON parse error: Cannot deserialize value of type `java.util.ArrayList<com.*****>` from Object value (token `JsonToken.START_OBJECT`); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.util.ArrayList<com.****>` from Object value (token `JsonToken.START_OBJECT`)
JSON parse error通常表示JSON格式的数据无法被正确解析。这可能是由于以下原因之一:
[
{
"name":"aa",
"sex":"男",
"age":"14"
},
{
"name":"ba",
"sex":"女",
"age":"24"
},
{
"name":"za",
"sex":"男",
"age":"13"
},
]