code: private static JSONObject extractObject(HttpResponse resp) throws IOException, JSONException {
          logger.entering(resp);
          BufferedReader rd = new BufferedReader(new InputStreamReader(resp.getEntity().getContent()));
          StringBuilder s = new StringBuilder();
          String line;
          while ((line = rd.readLine()) != null) {
              s.append(line);
          }
          rd.close();
          JSONObject objToReturn = new JSONObject(s.toString());
          logger.exiting(objToReturn);
          return objToReturn;
      }
docs: Converts a {@link HttpResponse} into a {@link JSONObject}
  
  @param resp
  A {@link HttpResponse} obtained from executing a request against a host
  @return An object of type {@link JSONObject}
  @throws IOException
  @throws JSONException