读取本地json文件并解析
StringBuilder result = new StringBuilder();
try (FileInputStream fileInputStream = new FileInputStream("本地json文件全路径");
InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, StandardCharsets.UTF_8);
BufferedReader reader = new BufferedReader(inputStreamReader);) {
String tempString = null;
while ((tempString = reader.readLine()) != null) {
result.append(tempString);
}
} catch (Exception e) {
e.printStackTrace();
}
//根据具体情况转成array或者object
JSONArray array = JSON.parseObject(result.toString(), JSONArray.class);