new JSONObject(res)的时候总是报Value of type java.lang.String cannot be converted to JSONObject。后来发现是UTF-8的BOM头问题,加上以下代码后正常:
if(string.startsWith("\ufeff")) {
string = string.substring(1);
}
new JSONObject(res)的时候总是报Value of type java.lang.String cannot be converted to JSONObject。后来发现是UTF-8的BOM头问题,加上以下代码后正常:
if(string.startsWith("\ufeff")) {
string = string.substring(1);
}