0
我有一個名爲JSONParse的基於JsonObject的類。有此方法:Json對象爲null
public String getName()
{
try {
JSONObject jobj = this.getJSONObject("Data");
Log.e("NFF NAME", jobj.toString());
JSONObject jobj2= jobj.getJSONObject("User");
Log.e("NFF NAME", jobj2.toString());
return jobj2.getString("username");
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "";
}
日誌:
03-19 19:50:09.280: E/NFF NAME(5909): {"User":{"picture":"http://vm19.htl-leonding.ac.at/img/30.png","gender":"f","username":"lisa","age":32}}
03-19 19:50:09.280: E/NFF NAME(5909): {"picture":"http://vm19.htl-leonding.ac.at/img/30.png","gender":"f","username":"lisa","age":32}
問題:
就永遠這個方法的名稱返回null。
請幫助
jobj2和jobj2b變量有什麼區別? – lexmiir 2012-03-19 20:06:34
不起作用...... – user547995 2012-03-19 20:07:18
job2和job2b指向同一節點 – 2012-03-19 20:11:09