Java tutorial
//package com.java2s; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; public class Main { /** * Reads test json * * @param filename * @return */ public static String readJSON(String filename) { try { FileInputStream fileInputStream = new FileInputStream(new File(filename)); InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream); BufferedReader bufferedReader = new BufferedReader(inputStreamReader); String readData = ""; StringBuffer stringBuffer = new StringBuffer(); while ((readData = bufferedReader.readLine()) != null) { stringBuffer.append(readData); } return stringBuffer.toString(); } catch (IOException e) { e.printStackTrace(); return e.toString(); } } }