JSON parse error: Cannot deserialize value of type
java.util.ArrayList<xxx.entity.ReviseInfo>
from Object value (token JsonToken.START_OBJECT
); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type java.util.ArrayList<xxx.entity.ReviseInfo>
from Object value (token JsonToken.START_OBJECT
)
at [Source: (PushbackInputStream); line: 1, column: 1]
【Controller】
@PostMapping("/add")
public Result<String> insert(@RequestBody List<ReviseInfo> reviseInfoList){
return reviseAdaptor.insert(reviseInfoList);
}
错误传参,报错
{
"reviseInfoList": [
{
"fragOri": "宁厦",
"fragFixed": "宁夏",
"type": 1
},
{
"fragOri": "历案",
"fragFixed": "立案",
"type": 2
},
{
"fragOri": "沈查",
"fragFixed": "审查",
"type": 3
}
]
}
正确写法,通过
[
{
"fragOri": "宁厦",
"fragFixed": "宁夏",
"type": 1
},
{
"fragOri": "历案",
"fragFixed": "立案",
"type": 2
},
{
"fragOri": "沈查",
"fragFixed": "审查",
"type": 3
}
]