redis通过json方案存取对象com.alibaba.fastjson.JSONException: syntax error, expect
问题描述:
redis基于json方案存取对象时报错:com.alibaba.fastjson.JSONException: syntax error, expect
com.alibaba.fastjson.JSONException: syntax error, expect {, actual [, pos 0
记一次FastJSON和Jackson解析json时遇到的中括号问题
突然发现自己取值的时候写法不对:
User jsonGetUser = JSON.parseObject(stringGet, User.class);(正确)
我误写成了
User jsonGetUser = JSON.parseObject("stringGet", User.class);(错误)
/**
* 方式二:采用json方案(推荐)
*/
User user1 = new User();
user1.setId("1001");
user1.setName("jsontest");
user1.setSex("female"); String jsonString = JSON.toJSONString(user1);
jedis.set("user1",jsonString);
System.out.println("json方式存储完毕");
String stringGet = jedis.get("user1");
User jsonGetUser = JSON.parseObject(stringGet, User.class);
System.out.println(jsonGetUser);
redis通过json方案存取对象com.alibaba.fastjson.JSONException: syntax error, expect的更多相关文章
- Caused by: com.alibaba.fastjson.JSONException: syntax error, expect {, actual [, pos 0, fastjson-version 1.2
环境: vue.js 问题: 当添加评论时 重新查询数据刷新数据控制台异常Caused by: com.alibaba.fastjson.JSONException: syntax error, ex ...
- 关于使用fastjson出现的问题:com.alibaba.fastjson.JSONException: syntax error, expect {, actual string, pos 1, fastjson-version 1.2.44
先说下需求:是从redis中根据keys批量获取数据集合,再通过fastjson转为对象集合 代码如下: 在postman测试后,出现错误如下: 刚开始以为是使用fstjson方法不对,后面先通过打断 ...
- fastjson 错误解决方案详情 com.alibaba.fastjson.JSONException: syntax error, expect {, actual EOF, pos 1410
原因: 前端传递的数组过于复杂,倒是出现这种问题,前端采用vue axios,发送请求,后端java接收代码,实现前后端分离 后端就收fastjson接收json,进行业务处理,后端Controlle ...
- JSON parse error: syntax error, expect {, actual error, pos 0, fastjson-version 1.2.58; nested exception is com.alibaba.fastjson.JSONExcetion: syntax error, except {, actual error, pos ...
这个报错信息告诉你,你提交的参数需要是json类型.所以,POST请求携带的数据需要序列化一下json.dumps(data).
- 解决使用Redis时配置 fastjson反序列化报错 com.alibaba.fastjson.JSONException: autoType is not support
1.问题描述 在使用redis时,配置自定义序列化redisTemplate为FastJsonRedisSerializer . 1 /** 2 * 自定义redis序列化器 3 */ 4 @Sup ...
- fastjson转换包含date类型属性的对象时报错com.alibaba.fastjson.JSONException: For input string: "13:02:19"
问题:time类型数据插入不进mysql数据库:调试的时候报如下错误: Caused by: java.lang.NumberFormatException: For input string: &q ...
- Json和Map互转,四个包(org.json/net.sf.json/com.google.gson/com.alibaba.fastjson)
目前使用的(org.json/net.sf.json/com.google.gson/com.alibaba.fastjson)这四种json-map互转,其他的以后在补充.............. ...
- com.alibaba.fastjson.JSONException: exepct '[', but error, pos 1, json : %255B%257B%2522list%2522%253A%255B%257B%2522itemId%2522%253A1369331%252C%2522num%2522%253A2%257D%255D%257D%255
com.alibaba.fastjson.JSONException: exepct '[', but error, pos 1, json : %255B%257B%2522list%2522%25 ...
- JSON parse error: default constructor not found. class java.time.YearMonth; nested exception is com.alibaba.fastjson.JSONException: default constructor not found. class java.time.YearMonth
java8新出的YearMonth可以方便的用来表示某个月.我的项目中使用springmvc来接收YearMonth类型的数据时发现 x-www-from-urlencoded 格式的数据可以使用&q ...
随机推荐
- jquery的each函数的用法
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- poj 2284 That Nice Euler Circuit 解题报告
That Nice Euler Circuit Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 1975 Accepted ...
- kafka存储机制
kafka存储机制 @(博客文章)[storm|大数据] kafka存储机制 一关键术语 二topic中partition存储分布 三 partiton中文件存储方式 四 partiton中segme ...
- 【12c】root container 和 pdb 的一些差别
Where\what ? root pdb 备注 Control files and redo log files Y belongs to the CDB and not to a spec ...
- 把Scala代码当作脚本运行
1. 在类UNIX系统上作为脚本运行 在类Unix系统上,你可以设置一个shell前导词来执行脚本.如下例: Script.scala #!/usr/bin/env scala !# println( ...
- iOS开发--整理常用的第三方资源
一:第三方插件 1:基于响应式编程思想的oc 地址:https://github.com/ReactiveCocoa/ReactiveCocoa 2:hud提示框 地址:https://github. ...
- Android消息通知-Notification
Android中常用的消息提醒,一种是Toast弹出提醒内容,一种是AlterDialog弹出框来提醒用户,还有一种就是消息通知的,用Android经常收到各种通知就是Notifation.Notif ...
- AIDL 定向tag IPC 案例 MD
Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...
- git简单运用
创建新仓库 创建新文件夹,打开,然后执行 git init 以创建新的 git 仓库. 检出仓库 执行如下命令以创建一个本地仓库的克隆版本: git clone /path/to/repository ...
- php防止sql注入漏洞代码 && 几种常见攻击的正则表达式
注入漏洞代码和分析 ...