I get this string array:
["HELLO","WORLD"]
And I want to output the same but without square brackets:
"HELLO","WORLD"
How can I replace or transform this with Dataweave in Mule?
I get this string array:
["HELLO","WORLD"]
And I want to output the same but without square brackets:
"HELLO","WORLD"
How can I replace or transform this with Dataweave in Mule?
Possible solutions (credit to @jerney in the comments)
Using index manipulation:
%dw 1.0
%output application/java
%var input = "[\"HELLO\", \"WORLD\"]"
---
input[1..-2]
Using regex:
%dw 1.0
%output application/java
%var input = "[\"HELLO\", \"WORLD\"]"
---
input replace /^\[|\]$/ with ""
Using simple replacement:
%dw 1.0
%output application/java
%var input = "[\"HELLO\", \"WORLD\"]"
---
input replace "[" with "" replace "]" with ""