just put you message string in a payload map and use object to JSON transformer ... you can use dynamic values for map <set-payload value="# [['Num': $param1, 'type':$param2]]" doc:name="Set Payload" /> <mule xmlns:json="http: 47; 47;www 46;mulesoft 46;org/...
Maybe look at the splitby function https://docs.mulesoft.com/mule4-user-guide/v/4.1/dw-core-functions-splitby Not sure if this is the most elegant, but gets the job done: %dw 2.0 output application/json --- using (secondBit = (payload[1] splitBy "|") ) (payload[0] splitBy ...