Return empty list when node is an object

This commit is contained in:
Xavi Aracil 2022-11-25 13:55:08 +01:00
parent 82ab70eaf9
commit f4f44f61ff

View File

@ -34,6 +34,9 @@ public class JsonNodeUtil {
public static List<String> asStringList(JsonNode node) { public static List<String> asStringList(JsonNode node) {
if(!(node instanceof ArrayNode)) { if(!(node instanceof ArrayNode)) {
if (node.isObject()) {
return List.of();
}
return List.of(node.asText()); return List.of(node.asText());
} else { } else {
ArrayNode arrayNode = (ArrayNode)node; ArrayNode arrayNode = (ArrayNode)node;