📑 How to add new line character in Dataweave 2.0 Mulesoft

Adding a new line character in the middle of a variable. If you want to print a part of the variable of Dataweave 2.0 in the next line we must use "\n".Find the below example of Dataweave 2.0 to print a part of variable in a new line - Mulesoft


How to add new line in Dataweave 2.0 code of Mule 4 or Mule 3


  1. +System.getProperty('line.separator')]

  2. Use "\n"

Dataweave code:

%dw 2.0
output application/plain
---
"County codes are as below\n" ++ "value:"

 

Result:

Country codes are as below
EU
US
UAE

Dataweave examples:
%dw 2.0
import java!java::lang::System
---
"abc" ++ System::lineSeparator() ++ "def"

How to print  in a new line for logger component in Mulesoft


Insert a new line in the Mule logger component which prints in Console. Use any below format to print in the next line
#[System.getProperty('line.separator')]

 #['\n']

Post a Comment

0 Comments