Android 报错 Value br of type java.lang.String cannot be converted to JSONObject

博主是使用Android + php + apache + tomcat 做数据处理时出现的这个问题;

报错内容:Value <br of type java.lang.String cannot be converted to JSONObject

(因为CSDN文章标题不能有非法字符,<被归类为非法字符,所以没有)

根本原因就是:php 的代码写错了,多了个 } ,由于php代码是在notepad++写的,没有自动检测,所以导致出错,

                         因此当Android这样报错时,应该仔细检查php代码或者说Json数据来源的那一边的代码

而直接原因就是:传来的String类型数据,有不符合json格式的内容,无法转换成json对象即JSONObject

总之:就是数据来源那边的数据有错误,不符合json数据格式

猜你喜欢

转载自blog.csdn.net/qq_40938301/article/details/82254613