首页 > 基础资料 博客日记
JSON parse error: Cannot deserialize value of type java.util.ArrayList<SalarySecurityDto> f解决方法
2024-10-16 04:00:07基础资料围观98次
Java资料网推荐JSON parse error: Cannot deserialize value of type java.util.ArrayList<SalarySecurityDto> f解决方法这篇文章给大家,欢迎收藏Java资料网享受知识的乐趣
Cannot deserialize value of type java.util.ArrayList<cn.wb.oa.server.salary.dto.SalarySecurityDto>
from Object value (token JsonToken.START_OBJECT
)
//报错原因大概意思是类型无法转换
//这是后端接收参数的方式
@RequestMapping(value = "/reset_batch", method = RequestMethod.POST)
public ResultResponse<Boolean> resetSalarySecurityBatch(@RequestBody List<SalarySecurityDto> salarySecurityDto) {
}
//这是后端传的参数
[
{
"schoolId": 21966,
"userId": 845072,
"securityCode": 999999,
"modifyUser": "林某"
},
{
"schoolId": 21966,
"userId": 778563,
"securityCode": 999999,
"modifyUser": "林某"
}
]
//接口没有报错
//这是前端传的参数
[
{
"schoolId": "W_SCHOOLID",
"userId": "55410",
"modifyUser": "林某",
"securityCode": "111111"
},
{
"schoolId": "W_SCHOOLID",
"userId": "767028",
"modifyUser": "林某",
"securityCode": "111111"
},
{
"schoolId": "W_SCHOOLID",
"userId": "778490",
"modifyUser": "林某",
"securityCode": "111111"
}
]
//报错显示类型无法转换
解决方法
//更改接收参数的方式
@RequestMapping(value = "/reset_batch", method = RequestMethod.POST)
public ResultResponse<Boolean> resetSalarySecurityBatch(@RequestBody SalarySecurityListDto salarySecurityList) {
List<SalarySecurityDto> salarySecurityDtolist = salarySecurityList.getSalarySecurityList();
}
SalarySecurityListDto实体类
public class SalarySecurityListDto implements Serializable {
private List<SalarySecurityDto> salarySecurityList;
}
文章来源:https://blog.csdn.net/java_rutu/article/details/139634085
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:jacktools123@163.com进行投诉反馈,一经查实,立即删除!
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:jacktools123@163.com进行投诉反馈,一经查实,立即删除!
标签: