Set<String> (JsonNode node) { JsonNode requiredList = node.get("required"); if (requiredList == null || (!requiredList.isArray() && requiredList.size() == 0)) return Collections.emptySet(); Set<String> result = new TreeSet<>(); for (JsonNode element : requiredList) { if (element.isTextual()) { result.add(element.asText()); } } return result; }