Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path可能解决方式
来源:互联网 发布:若四阶矩阵a与b相似 编辑:程序博客网 时间:2024/05/19 01:10
Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path:
我这返回的json有以下两个字段:
"delay_arrtime": "-11512",
"delay_deptime": "-3712",
我在解析时:
info.setDelay_deptime(json.optString("delay_deptime"));
info.setDelay_arrtime(json.optString("delay_arrtime"));
用optLong()也是一样
改成optInt()就可以了:
info.setDelay_deptime(json.optInt("delay_deptime"));
info.setDelay_arrtime(json.optInt("delay_arrtime"));
其它的检测及解决方式参考:
(1)http://blog.csdn.net/aaren_jiang/article/details/12849777#java
关于Gson解析的异常,我花费两个小时才调试出来。如果你程序出现以下的异常,有两种可能性:‘
1. 找到一个JSON格式的验证工具,这个网上很多大家可以百度下
2.你的JSON格式验证没有问题,却一直报这个解析错误,请确定你的JSON数据没有多余的空格。这个空格有可能在IO流读取的时候多读了
(2)http://blog.csdn.net/u013290250/article/details/51614490
1.首先第一步,检查你联网的URL是否正确。
2.第二步,检查你写的模型是否正确。
- Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path可能解决方式
- .MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1
- Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 4171 异常的解决方法
- 关于Gson解析异常:Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $
- Use JsonReader.setLenient(true) to accept malformed JSON at line 10 column 2
- android.util.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at lin
- com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed J
- Unterminated object at line 1 column 167 path $.header.report_url
- Expected a string but was BEGIN_OBJECT at line 1 column 2 path $(不让retrofit2自动替我解析json)
- 关于SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data错误的解决
- android retrofit End of input at line 1 column 1 path
- SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the JSON火狐
- Gson 解析时候报错: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
- java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 39 path $
- android报错 Expected BEGIN_OBJECT but was STRING at line 1 column 39 path $
- Expected BEGIN_OBJECT but was BEGIN_ARRARY at line 1 column 2 path$异常解决方法
- Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path 解决办法
- Gson 解析时候报错: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
- Oracle之游标的使用
- Windows server 2008 企业版 Sqlserver2008标准版在IBM X3650上实现双机热备2
- Qt
- 产生一个随机数验证码
- Android Studio —— 重装 HAXM
- Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path可能解决方式
- 事务的隔离性
- Eclipse连接到My sql数据库的操作总结/配置数据库驱动
- asn1c
- 浅谈 LayoutInflater
- 数据库设计技巧
- Deep Learning
- Linux
- Eclipse连接到My sql数据库之前操作