For example, we have a BufferedReader reader, associated with the json file through
InputStreamReader. To get a file data we can do this:
String line; try {
while ((line = reader.readLine()) != null) { builder.append(line);
}
JSONObject json = new JSONObject(builder.toString());
return json;
} catch (IOException | JSONException exception) {
exception.printStackTrace();
JSONObject line; try {
while ((line = reader.readJSONObject ()) != null) { builder.append(line);
} catch (RuntimeException|ArrayIndexOutOfBoundsException exception) {
Submit