JSONException: java.lang.String cannot be converted to JSONObject
来源:互联网 发布:天天酷跑软件 编辑:程序博客网 时间:2024/06/03 06:01
安卓解析JSON数据时,巧遇此问题。
使用bejson查看,确认json格式正确,数据没有问题。但是我解析也的代码也不可能出错,因为换过几台设备,就一台出现问题。
一时无解之下,只得求助于度娘——UTF-8之BOM!!!(feff)
解决如下:
public static final String removeBOM(String json) { if (json!=null && json.startsWith("\ufeff")) { return json.substring(1); } else { return json; }}
这才发现,怎么出的问题。接口开发之时,用Notepad编辑过。
以后需要注意选择编码格式 “以UTF-8无BOM格式编码” 。
0 0
- JSONException:java.lang.String cannot be converted to JSONObject解决办法
- JSONException:java.lang.String cannot be converted to JSONObject解决办法
- JSONException:java.lang.String cannot be converted to JSONObject
- JSONException: java.lang.String cannot be converted to JSONObject
- org.json.JSONException: Value of type java.lang.String cannot be converted to JSONObject
- org.json.JSONException: Value of type java.lang.String cannot be converted to JSONObject
- org.json.JSONException: Value of type java.lang.String cannot be converted to JSONObject
- org.json.JSONException: Value of type java.lang.String cannot be converted to JSONObject
- org.json.JSONException: Value of type java.lang.String cannot be converted to JSONObject
- org.json.JSONException: Value of type java.lang.String cannot be converted to JSONObject
- org.json.JSONException: Value of type java.lang.String cannot be converted to JSONObject
- JSONException: Value of type java.lang.String cannot be converted to JSONObject
- org.json.JSONException: Value of type java.lang.String cannot be converted to JSONObject
- org.json.JSONException: Value of type java.lang.String cannot be converted to JSONObject
- org.json.JSONException: Value ok of type java.lang.String cannot be converted to JSONObject:
- org.json.JSONException: Value ok of type java.lang.String cannot be converted to JSONObject: [Caugh
- java.lang.String cannot be converted to JSONObject
- Json解析异常处理方式(JSONException: Value of type java.lang.String cannot be converted to JSONObject)
- fp-grows,pfp-grows与协同过滤cf
- 排序方法总结(1)冒泡排序 选择排序
- 门户网站的发展5事情你要问你的潜在门户网站设计师
- 为什么要使用 Go 语言,Go 语言的优势在哪里?
- ListView、ListBox和GridView的结构
- JSONException: java.lang.String cannot be converted to JSONObject
- arm-Linux 编译动态库 简单实例
- 使用xtrabackup实现MySQL主从复制
- 门户网站的发展5事情你要问你的潜在门户网站设计师
- persits.jpeg 水印组件
- HTML中head里的内容经浏览器解析后全到body里了
- Effective C++读书笔记之一:视C++为一个联邦
- centos 快速搭建vpn
- 揭秘传智播客毕业薪资超7k内幕序列之六---退伍兵,药品管理员,月薪1700,如何在半年内“战斗力”爆满,成功“斩获”1万薪资职位?