Question

I have a payload that's a JsonNode, which contains an ArrayNode. I would like to use this ArrayNode and iterate over its elements in a ForEach element. I set my ForEach collection variable as #[payload.get("MyArrayNode").getElements()], but I get an error that the object cannot be used by the ForEach component. I have also tried #[payload.get("MyArrayNode")] without success either.

Is there a way to iterate over Jackson objects or should I convert my payload to something else?

Était-ce utile?

La solution

You can use IteratorUtils to create a List from the getElements Iterator:

#[org.apache.commons.collections.IteratorUtils.toList(payload.get('MyArrayNode').elements)]
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top