在java-resource下新建一个paperTree.json的文件保存数据、采用Resource resource = new ClassPathResource读取方式、JSON.parseObject解析
/*** 获取试卷类型树形菜单* @return*/@PostMapping("/paperTree")public Resp<Object> paperTree() throws IOException {JSONArray arry = null;try {Resource resource = new ClassPathResource("paperTree.json");JSONObject json = JSON.parseObject(IOUtils.toString(new FileInputStream(resource.getFile())));arry = json.getJSONArray("list");} catch (IOException e) {e.printStackTrace();}return Resp.ok().setResult(arry);}