JSONException:java.lang.String类型的值不能转换为JSONObject
private InputStream is = null;private String json = "";private JSONObject jObj = null;try {
BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
is.close();
// hier habe ich das JSON-File als String
json = sb.toString();
Log.i("JSON Parser", json);} catch (Exception e) {
Log.e("Buffer Error", "Error converting result " + e.toString());}// try parse the string to a JSON objecttry {
jObj = new JSONObject(json);} catch (JSONException e) {
Log.e("JSON Parser", "Error parsing data " + e.toString());}// return JSON Stringreturn jObj;}try {
jObj = new JSONObject(json);} catch (JSONException e) {
Log.e("JSON Parser", "Error parsing data " + e.toString());}
04-22 14:01:05.043:e/JSON Parser(5868):错误解析数据org.json.JSONException:value/异号此处/类型为java.lang.String不能转换为JSONObject
青春有我
相关分类