1.依赖

org.apache.commons
commons-io
1.3.2


com.alibaba
fastjson
1.2.29

2.代码实现
将json文件放在resource下

File jsonFile = ResourceUtils.getFile(“classpath:city.json”);
String json = FileUtils.readFileToString(jsonFile,“UTF-8”);
JSONArray jsonArray = JSON.parseArray(json);
3.读取resource下的json文件

相关文章:

  • 2022-01-12
  • 2021-11-27
  • 2021-08-11
  • 2021-06-22
  • 2022-12-23
  • 2022-01-03
  • 2022-12-23
  • 2022-01-07
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案