List of utility methods to do HTTP Get Json
JSONObject | getJSON(HttpURLConnection conn) get JSON JSONObject job = null; conn.setRequestMethod("GET"); OutputStream os = conn.getOutputStream(); conn.connect(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); StringBuffer sb = new StringBuffer(); String s = ""; while ((s = in.readLine()) != null) { ... |
JsonNode | getJSON(String url) get JSON ObjectMapper mapper = new ObjectMapper(); String jsonStr = get(url); return mapper.readTree(jsonStr); |
JSONObject | getJSON(URL url) get JSON String body = get(url); JSONTokener tokener = new JSONTokener(body); return new JSONObject(tokener); |