Java Utililty Methods HTTP Get Json

List of utility methods to do HTTP Get Json

Description

The list of methods to do HTTP Get Json are organized into topic(s).

Method

JSONObjectgetJSON(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) {
...
JsonNodegetJSON(String url)
get JSON
ObjectMapper mapper = new ObjectMapper();
String jsonStr = get(url);
return mapper.readTree(jsonStr);
JSONObjectgetJSON(URL url)
get JSON
String body = get(url);
JSONTokener tokener = new JSONTokener(body);
return new JSONObject(tokener);