java - 如何在邮递员中发送包含数组列表的对象
问题描述
我正在用 springboot rest API 做一个项目。我的控制器类如下所示,
@RequestMapping(value = "/artdimfil", method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
@ResponseBody
public boolean saveArticleDimFilter(@RequestBody ArtDimFil artDimFil)
我想在邮递员中发送以下有效负载,
{
"id": "b30d1486-04c8-4acc-8d14-8604c81accab",
"docIdentifier": {
"recType": "ABC",
"accesslist": [
{
"userid": "xyz@abc.com",
"role": "abc",
"status": "Active",
"actiondate": "2020-07-03T17:59:34.600+0000",
"name": "XYZ",
}]
}
}
但它给出了错误说法
[org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize instance of `com.ibm.epm.next.model.Accesslist` out of START_ARRAY token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `com.ibm.epm.next.model.Accesslist` out of START_ARRAY token.
请建议我该怎么做。
解决方案
它试图反序列化为“AccessList” - 但我认为它没有使用您的“AccessList”,因为错误说:无法反序列化实例com.ibm.epm.next.model.Accesslist
我建议你重命名你的类,或者确保你有正确的导入语句。您应该导入自己的“AccessList”类。
推荐阅读
- reactjs - 如何输入提升状态的 React 道具
- c - 检查二维数组中有多少个显性数字
- javascript - 声音存储在 vuejs 的本地文件中
- python - Python打包:在(pip)安装时询问用户变量值
- microsoft-teams - 在同一团队中复制/复制计划者计划
- python - 如何使用 python 将文件从 Flask 的 HTML 表单上传到 S3 存储桶?
- python - 如何解决意外的 Tor 行为?用户代理和 HTTPS 协议显示我的实际 ip
- python - 硒查找特定参数python
- javascript - 更改输入类型文件文本
- asp.net - ASP.NET 4.6 SPA,通过 MsBuild 动态发布整个 wwwroot 内容