
JSON
zoroDcup
这个作者很懒,什么都没留下…
展开
-
No serializer found for class cn.hutool.json.JSONNull and no properties discovered to create BeanSer
项目背景:后台通过JSONObject形式存入到redis,前台通过hutool方式将jsonstring转换为jsonobject对象使用时报错,错误信息如标题所示。搜索问题发现有大佬说:Hutool会使用JSONNull来表示空值,而SpringBoot默认使用的序列化是Jackson,在接口调用过程中使用了Map,直接传入了Hutool的JSONObject,而该Map存在空值,所以存在JSONNull,最终导致错误。我的解决方案为不通过hutool工具来转换,也即JSONObj原创 2021-09-14 16:03:45 · 6949 阅读 · 1 评论 -
JSON取值(key是中文或者数字)方式详解
JSON取值(key是中文或者数字)方式详解先准备一个json对象用于演示var json = {'name':'zhangsan', '年龄':23, 404:'你可能迷路了'}; 使用JS中with关键字 with(json) { console.log(name);//输出:zhangsan console.log(年龄);//输出:23 ...转载 2018-12-05 10:02:26 · 4847 阅读 · 0 评论