net.sf.json.JSONException: JSONObject[“xxxx”] not found
1、問題描述
JSONObject jsonObject = user.getuser(username);
String userName = jsonObject.getString(“data”);
然後:
net.sf.json.JSONException: JSONObject[“data”] not found…
2、問題解決
JSONObject jsonObject = user.getuser(username);
if(jsonObject.has("data")){
String userName = jsonObject.getString("data");
} else{
system.out.println(“你的業務”)
}