读取内容存为String
public static String parseJSONFile(String filename) throws JSONException, IOException { String content = new String(Files.readAllBytes(Paths.get(filename))) return content }
读取内容存为JSONObject
public static JSONObject parseJSONFile2(String filename) throws JSONException, IOException { String content = new String(Files.readAllBytes(Paths.get(filename))) return new JSONObject(content) }