If I have arrays [A,B,C]
and [1,2,3]
How can I combine them to be [A,1,B,2,C,3]
Asked
Active
Viewed 98 times
3
2 Answers
4
Assuming both arrays have the same length:
%dw 2.0
output application/json
var a1=["A","B","C"]
var a2=[1,2,3]
---
a1 flatMap [$, a2[$$]]
Output:
[
"A",
1,
"B",
2,
"C",
3
]

aled
- 21,330
- 3
- 27
- 34