I'm new to Java. Geting simple answer from server
{"response":"ok"}
I can successfully output answer from above in virtual device in Android Studio 3 with:
try {
...
String finalJson = buffer.toString();
return finalJson;
}catch...
Now I want to display only ok
from server response.
As I understood from How to parse JSON in Android, I need to write in try
this:
JSONObject jObject = new JSONObject(finalJson);
String aJsonString = jObject.getString("response");
return aJsonString;
But getting
error: unreported exception JSONException; must be caught or declared to be thrown
I even tried this Getting String Value from Json Object Android to be sure that this is not array.