문제

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?

도움이 되었습니까?

해결책

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

#[org.apache.commons.collections.IteratorUtils.toList(payload.get('MyArrayNode').elements)]
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top