com.google.gson.stream.MalformedJsonException的解决办法
关于Gson解析的异常,如果你程序出现以下的异常,有两种可能性:‘
1. 找到一个JSON格式的验证工具,这个网上很多大家可以百度下;
2.你的JSON格式验证没有问题,却一直报这个解析错误,请确定你的JSON数据没有多余的空格。这个空格有可能在IO流读取的时候多读了。
com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 33
at com.google.gson.Gson.assertFullConsumption(Gson.java:779)
at com.google.gson.Gson.fromJson(Gson.java:769)
at com.google.gson.Gson.fromJson(Gson.java:717)
at com.google.gson.Gson.fromJson(Gson.java:689)
at com.ant.Test.main(Test.java:24)
Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 33
at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1505)
at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1386)
at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:531)
at com.google.gson.stream.JsonReader.peek(JsonReader.java:414)
at com.google.gson.Gson.assertFullConsumption(Gson.java:775)
... 4 more
com.google.gson.stream.MalformedJsonException的解决办法的更多相关文章
- com.google.gson.stream.MalformedJsonException
今天下午项目更新后,调用接口时,提示“请求失败”,发现项目网络框架解析时,报错如下:com.google.gson.stream.MalformedJsonException: Unterminate ...
- 小米google play service停止工作解决办法,不root,不刷第三方recovery(也适用于其他的手机)
问题: 原因是手机安卓系统是6.0.系统应用里面没有包含谷歌框架等一系列谷歌的小东西. 参考: http://www.miui.com/thread-3548436-1-1.html http://w ...
- file_put_contents () failed to open stream: Permission denied 解决办法
今天,帮朋友配置服务器thinkphp5的时候,直接访问“www.***.com/admin/index/index” : 出现以下错误: file_put_contents (/PHP/admin/ ...
- Google Home Mini配置失败解决办法
Google Home Mini配置到最后一步时失败: There was a problem setting up Google Home Mini For help resolving this ...
- 【转】火狐右键google搜索特别慢的解决办法
原网页:http://www.fatalist.im/blog/459.html google将谷歌中文网站google.cn的搜索服务转向到google.com.hk(香港)后,firefox右上角 ...
- GSON 报错HibernateProxy. Forgot to register a type adapter? 的解决办法
使用Gson转换hibernate对象遇到一个问题,当对象的Lazy加载的,就会出现上面的错误.处理方式摘抄自网上,留存一份以后自己看. 网上找到的解决办法,首先自定义一个类继承TypeAdapter ...
- 通过nginx转发,用外网连接阿里云的redis,报Unexpected end of stream的解决办法
一.在与redis同一个内网的服务器上A的nginx做了下面的设置 stream { upstream redis { server redis.rds.aliyuncs.com:6379 max_ ...
- Exception in thread “main” com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: empty String
String json="A valid json"; Job job = new Gson().fromJson(json, Job.class); Exception in t ...
- The type R is already defined 错误解决办法
今天在导入一个开源项目的时候遇到了The type R is already defined的错误,试过了删除R,clear project都还是报这个错,Google一下之后找到了解决办法在 Pro ...
随机推荐
- influxdb api
https://influxdb-python.readthedocs.io/en/latest/examples.html
- 使用py 和flask 实现的服务器系统目录浏览,日志文件实时显示到网页的功能
看日志希望带有彩色,希望从浏览器上看到,不用连到机器上看. 浏览系统的文件夹,scan + 系统文件夹的层级名字当做url路由,可以深层次看到机器上任何层级的文件夹,实现系统文件夹浏览下载. 如果是点 ...
- oracle中创建sequence指定起始值
oracle中创建sequence指定起始值 DECLARE V_Area_Id NUMBER; BEGIN SELECT MAX(T.Area_Id)+10 INTO V_Area_Id FROM ...
- Ajax前端调后台方法
后台对当前页面类进行注册 Ajax.Utility.RegisterTypeForAjax(typeof(Login));//Login 当前类名 在方法上面加 [Ajax.AjaxMethod(Aj ...
- BluetoothFindFirstRadio 函数
HBLUETOOTH_RADIO_FIND BluetoothFindFirstRadio( BLUETOOTH_FIND_RADIO_PARAMS* pbtfrp, HANDLE* phRadio ...
- javaScript之Array方法
Array类型和其他语言一样,是数据的有序列表,但不同的是数组的每一项们可以保存任何类型的数据. 1.检测方法(确定某个对象是不是数组) (1)value instanceof Array (2)Ar ...
- Dexdump 无法正常反编译问题
WIN环境下无法正常运行,提示Unable open XXX as zip 解决方案:使用APKTOOL + JD-GUI进行替代反编译
- [tyvj1860]后缀数组
题目链接:http://www.tyvj.cn/p/1860 解题关键:模板题.贴一个代码详解 http://www.cnblogs.com/staginner/archive/2012/02/02/ ...
- 9、perldoc文档阅读器
转载:http://www.cnblogs.com/nkwy2012/p/6016320.html 一般来说,将文档的名称作为参数传递给perldoc命令,即可查阅该文档.比如下面,给定文档名称per ...
- 配置OpenCV报应用程序无法正常启动0xc000007b
我的配置软件是OpenCV3.4.1和visual studio2017.参考这篇博客(https://blog.csdn.net/qq_41175905/article/details/805604 ...