public ArrayList<JSONObject> getMenuJson() throws IOException {
//ClassPathResource resource = new ClassPathResource("/home/portal/menu.txt");
//File filePath = resource.getFile();
File filePath = new File("/home/portal/menu.txt");
JSONArray btnArray = null;
String input = FileUtils.readFileToString(filePath, "UTF-8");
JSONObject jsonObject = JSONObject.fromObject(input);
if (jsonObject != null) {
btnArray = jsonObject.getJSONArray("menuList");
}
Map<String, List<MenuDto>> btnMap = new HashMap<>();
Iterator<Object> num = btnArray.iterator();
ArrayList<JSONObject> btns = new ArrayList<JSONObject>();
while (num.hasNext()) {
JSONObject btn = (JSONObject) num.next();
btns.add(btn);
}
return btns;
}
JSONObject
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>