JSON parse error: Cannot deserialize value of type
java.util.ArrayList
from Object value (token JsonToken.START_OBJECT
); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type java.util.ArrayList
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);
}
- 1
- 2
- 3
- 4
错误传参,报错
{
"reviseInfoList": [
{
"fragOri": "宁厦",
"fragFixed": "宁夏",
"type": 1
},
{
"fragOri": "历案",
"fragFixed": "立案",
"type": 2
},
{
"fragOri": "沈查",
"fragFixed": "审查",
"type": 3
}
]
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
正确写法,通过
[
{
"fragOri": "宁厦",
"fragFixed": "宁夏",
"type": 1
},
{
"fragOri": "历案",
"fragFixed": "立案",
"type": 2
},
{
"fragOri": "沈查",
"fragFixed": "审查",
"type": 3
}
]
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17