diff --git a/jmespath-gson/src/main/java/io/burt/jmespath/gson/GsonRuntime.java b/jmespath-gson/src/main/java/io/burt/jmespath/gson/GsonRuntime.java index 9eb9a820..59cd8688 100644 --- a/jmespath-gson/src/main/java/io/burt/jmespath/gson/GsonRuntime.java +++ b/jmespath-gson/src/main/java/io/burt/jmespath/gson/GsonRuntime.java @@ -58,8 +58,9 @@ public List toList(JsonElement value) { if (value.isJsonArray()) { return new JsonArrayListWrapper(value.getAsJsonArray()); } else if (value.isJsonObject()) { - List list = new ArrayList<>(value.getAsJsonObject().size()); - for(Map.Entry entry : value.getAsJsonObject().entrySet()) { + JsonObject object = value.getAsJsonObject(); + List list = new ArrayList<>(object.size()); + for(Map.Entry entry : object.entrySet()) { list.add(entry.getValue()); } return list;