String wat = "";
try{
JSONObject responsee = new JSONObject(result);
wat = responsee.getString("Result");
}
catch(JSONException e){
Log.e("log_tag", "Error parsing data "+e.toString());
}
result = {“Result”:”D”}
This code crashes application and throws following error:
Error parsing data org.json.JSONException: No value for {"Result":"D"}
responseeitself a json object you need. You don’t need to callgetJSONObjecton it. Just useresponsee.getString("Result");. Here is an example where you may need to usegetJsonObject: