use of net.minidev.json.JSONArray in project knox by apache.
the class ListResourcesRequest method parseResourceNames.
protected List<String> parseResourceNames(BasicResponse response) throws Exception {
List<String> result = new ArrayList<>();
JSONObject json = (JSONObject) new JSONParser(0).parse(response.getBytes());
if (json != null) {
JSONArray items = (JSONArray) json.get("items");
if (items != null) {
for (Object item1 : items) {
JSONObject item = (JSONObject) item1;
String name = (String) item.get("name");
if (name != null) {
result.add(name.substring(0, name.lastIndexOf('.')));
}
}
}
}
return result;
}
Aggregations