读取内容存为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)
}

  

相关文章:

  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2021-05-23
  • 2021-06-12
  • 2022-12-23
  • 2022-01-02
  • 2022-12-23
猜你喜欢
  • 2021-09-05
  • 2021-10-08
  • 2022-12-23
  • 2022-12-23
  • 2021-07-21
  • 2021-07-02
  • 2022-12-23
相关资源
相似解决方案