Search code examples
dataweavemulesoft

Mule 4/DW2.0 - Convert ["B_B001","C_C001", "D_D01" ] to ('B_B001','C_C001', 'D_D01' )


Input - ["B_B001","C_C001", "D_D01" ]

Output - ('B_B001','C_C001', 'D_D01' )


Solution

  • There are multiple ways to achieve it. Assuming this is a payload in an array and you want to change it to an output shown on your example as a text/plain, try the following script:

    %dw 2.0
    output text/plain
    ---
    "('" ++ (payload joinBy "','") ++ "')"