JSON parse error: Cannot construct instance of “xxx“(although at least one Creator exists)
今天写SpringBoot出现一个错误
JSON parse error: Cannot construct instance of `priv.kuki.param.AddressListParam` (although at least one Creator exists)
原因
@Data
@NoArgsConstructor // 加上该注解解决问题
public class AddressListParam {@NotNull // 加注解报错@JsonProperty("user_id")private Integer userId;
}
这是一个通过id查询地址的接口,我给id加上不为空的注解后,出现JSON反序列化错误。
解决方案
在类上加上@NoArgsConstructor
注解。
错误原因
- 错误的原因是没有无参构造函数,
- json在转对象反序列化的时候,需要先初始化对象,默认调用无参构造函数,再赋值,
- 因而需要创建无参构造器。
JSON parse error: Cannot construct instance of “xxx“(although at least one Creator exists)相关推荐
- JSON parse error: Cannot construct instance of
JSON parse error: Cannot construct instance of 原因: 页面提交json字符串到后台,使用spring mvc接收,出错.验证了好久终于发现问题 解决方法 ...
- Cannot construct instance of `com.*` (although at least one Creator exists): cannot deserializ
今天开发的springboot项目的时候,当前端发出请求的时候,还没有进入controller层就爆出了这样的一个错误. Cannot construct instance of `com.***.* ...
- 解决POSTMAN传参报错,JSON parse error: Cannot deserialize instance of `java.util.ArrayList` out of START_OB
前言:使用POSTMAN自测代码以便前后端联调时,发送请求后,BOOM!!!服务器抛了个这样式的东西出来. Resolved [org.springframework.http.converter.H ...
- JSON parse error: Cannot deserialize instance of `com.haha.phb.io.UserArrayIO
前言 最近开发新项目,接收前端提交的数组,报错 错误信息 {"timestamp": "2020-11-26T12:28:21.713+0000"," ...
- Cannot construct instance of `com.*` (although at least one Creator exists): cannot deserialize
今天在写springboot单元测试的时候,序列化对象时出现一个错误: Cannot construct instance of `com.*.GeneralResponse` (although a ...
- 报错:ON parse error: Cannot deserialize instance of `java.util.ArrayList<..> out of START_OBJECT
JSON parse error: Cannot deserialize instance of java.util.ArrayList<com.sangfor.ngsoc.knowledge. ...
- 一个json传参的错误:JSON parse error: Unrecognized token ‘xxx‘{ “timestamp“: “2022-03-06T16:06:29.866
一个json传参的错误: JSON parse error: Unrecognized token 'xxx' { "timestamp": "2022-03-0 ...
- 编码格式问题 错误:JSON parse error: Invalid UTF-8 middle byte 0x3f
接口因为编码不一致导致出错: org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: ...
- bug记录--------JSON parse error:Cannot deserialize value of type `com.test.EnumTest` from String
在查询类型的时候定义了一个枚举EnumTest,这样前端传类型的时候传枚举就可以. 然后在查询的时候报错: JSON parse error:Cannot deserialize value of t ...
最新文章
- 在实施OKR之前,你必须先了解这7点
- Angular2入门教程-1
- mysql用户名长度_如何增加PhpMyAdmin / mysql用户帐户的用户名长度?
- mysql5.7 部署文档-rpm
- 2020最常用的8个代码编辑器推荐
- [转载] LeetCode题解(面试16.22):兰顿蚂蚁(Python)
- 2019年上半年 系统分析师 论文 真题
- linux下iwconfig命令参数
- 渗透测试技术----服务扫描(一)--Banner、服务版本扫描、操作系统识别
- IMWeb小白-诗歌作业
- RHCE(一、二)nmcli命令学习、Linux例行性工作命令atd和crond学习
- UI自动化测试神器->Cypress
- 为选区添加描边_ps怎么给选区加上虚线描边
- 泛微oa流程表单之明细表下拉框事件
- java导出eml_java 本地生成带附件的eml文件
- win7无法打开计算机共享文件夹,Win7共享文件夹无法访问怎么办
- EMW3080固件烧录方法
- 浅谈敏捷 - Scrum
- 怎么恢复永久删除的文件
- dijkstra标号法表格_dijkstra算法模板及其用法
热门文章
- EXFO 光时反射仪MAX-730C-SM1基本规格
- 任务7、统计一组学生成绩
- Debian学习笔记——硬件
- springcloud项目读取不到application.properties
- android项目中文字乱码的问题
- C语言进阶——地址和指针
- 银行提供了整数整存整取定期储蓄业务,其存期分为一年,两年,三年,五年,到期凭存单支取本息,编写一个程序,输入存入的本金数目,计算假设存一年,两年,三年,五年,到期取款时,银行应支付多少本息分别是多少
- 数学图形(1.3)旋轮线
- iTOP3A5000_7A2000开发板龙芯全国产处理器LoongArch架构核心主板
- 桌面型计算机与台式机的区别,干货分享|迷你电脑主机跟普通的台式机有何区别呢?...