Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static String readJSON(String url) throws IOException {
- URL urlObj = new URL(url);
- HttpURLConnection connection = (HttpURLConnection) urlObj.openConnection();
- connection.addRequestProperty("Accept", "application/json");
- connection.connect();
- BufferedReader in =new BufferedReader(new InputStreamReader(connection.getInputStream()));
- String json = "", tmp;
- while ((tmp = in.readLine()) != null)
- json += tmp;
- connection.disconnect();
- return json;
- }
Add Comment
Please, Sign In to add comment