Value of type java.lang.String cannot be converted to JSONObject 错误解决
来源:互联网 发布:文件夹定时拷贝软件 编辑:程序博客网 时间:2024/04/28 20:42
JSONObject obj = new JSONObject(jsonStr);一个简简单的json解析居然报错!!并且json字符串没错!!!!
这个情况百分百是因为UTF-8的BOM头。
解决办法是:
public String JSONTokener(String in) { // consume an optional byte order mark (BOM) if it exists if (in != null && in.startsWith("\ufeff")) { in = in.substring(1); } return in; }JSONObject obj = new JSONObject(JSONTokener(jsonStr));
0 0
- Value of type java.lang.String cannot be converted to JSONObject 错误解决
- Value of type java.lang.String cannot be converted to JSONObject
- 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
- Android : 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
- 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 JSONArra
- Android 面试题总结之View(一)
- JavaScript 易错知识点整理
- jQuery基本过滤选择器
- org.json.JSONException: Value of type java.lang.String cannot be converted to JSON
- 记录下使用Glide加载圆形图和圆角图
- Value of type java.lang.String cannot be converted to JSONObject 错误解决
- 中文字符串的字节流
- 【例题】【高斯消元】USACO3.2.4 Feed Ratios
- 由SpringJdbc引发的一点思考
- dyld: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/UserNotifications
- SpringMvc如何传递获取Date类型数据
- python爬虫学习(一)通过urllib2模块获取html,设置用户代理
- linux问题记录:too many levels of symbolic links
- 利用Apache的CommonPool2编写连接池