Convert String To Array In Dataweave 2.0
To convert string to array you can use SplitBy function of dataweave 2.0
Example 1:
Input
Hello World
Dataweave 2.0 Expression
%dw 2.0 output application/java --- payload splitBy(" ")
Output
[Hello, World]
Example 2:
Input
a.b.c.d
Dataweave 2.0 Expression
%dw 2.0 output application/java --- payload splitBy(".")
Output
[a,b,c,d]
Thank you for taking out time to read the above post. Hope you found it useful. In case of any questions, feel free to comment below. Also, if you are keen on knowing about a specific topic, happy to explore your recommendations as well.
For any latest updates or posts on our website, you can follow us on LinkedIn. Look forward to connecting with you there.
%dw 2.0
output application/java
var a = “a.b.c”
—
a splitBy “.”