I want to retrieve JSON from a web-service and parse it then.
Am I on the right way?
HttpClient httpclient = new DefaultHttpClient();
HttpGet htt
Using gson and EntityUtils:
HttpEntity responseEntity = response.getEntity();
try {
if (responseEntity != null) {
String responseString = EntityUtils.toString(responseEntity);
JsonObject jsonResp = new Gson().fromJson(responseString, JsonObject.class); // String to JSONObject
if (jsonResp.has("property"))
System.out.println(jsonResp.get("property").toString().replace("\"", ""))); // toString returns quoted values!
} catch (Exception e) {
e.printStackTrace();
}