try {
JSONObject jsonObject = new JSONObject(jsonString);
} catch (JSONException e) {
e.printStackTrace();
}
if (jsonObject.has("field")) {
String value = jsonObject.getString("field");
} else {
}
try {
int value = jsonObject.getInt("field");
} catch (JSONException e) {
e.printStackTrace();
}
try {
} catch (JSONException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
import org.json.JSONException;
import org.json.JSONObject;