Hi Team,
I am trying to convert my payload from Array to String in dataweave but facing the issue.
this is my payload: [ "a@gmail", "b@gmail", "c@gmail", "d@gmail", null, "e@gmail", "f@gmail", "g@gmail", "h@gmail", "" ] and i want to get it as string. In that payload, i could see the null and "" empty fields. I tried with payload reduce ( $$ ++ $ ) but no luck. could you please help me how to short out this issue.
Hi, @ramugudivada.
I'm not entirely sure of the output that you want to obtain, but a possible way to generate a string from that array could be to filter the nulls and empty elements from it and then performing a join.
Eg.
%dw 1.0
%output application/java
---
(payload filter ($ != null and $ != "" )) joinBy ", "
Regards