<set-payload value="{ 'name' : 'Ana', 'office' : 'BA' }" mimeType="application/json" encoding="UTF-8"/>
Set Payload Transformer
Standard Support for Mule 4.1 ended on November 2, 2020, and this version of Mule reached its End of Life on November 2, 2022, when Extended Support ended. Deployments of new applications to CloudHub that use this version of Mule are no longer allowed. Only in-place updates to applications are permitted. MuleSoft recommends that you upgrade to the latest version of Mule 4 that is in Standard Support so that your applications run with the latest fixes and security enhancements. |
The Set Payload (set-payload
) component lets you update the payload of the message.
The payload can be a literal string or a DataWeave expression. The set-payload
component, however, is not recommended for complex expressions or transformations
but rather, simple ones, such as selections. You should use Transform Message Component
for complex scenarios.
Field | Usage | Description |
---|---|---|
Value ( |
Required |
Accepts a literal string or DataWeave expression that defines how to set the payload, for example, |
Mime Type ( |
Optional |
The mime type of the value assigned to the payload, for example, |
Encoding ( |
Optional |
The encoding of the value assigned to the payload, for example, |
The |
This XML example sets a payload with static values:
The next example sets the message payload to "Hello, World" appending today’s date using a DataWeave expression:
#['Hello World!' ++ ' Today is ' ++ now()]
<set-payload value="#['Hello World!' ++ ' Today is ' ++ now()]"/>