---
schema_version: "1"
id: 3ad31387a9ea102dab0869cd99b96fefbd3056ffb2d628b50149261547e73591
title: Set Payload Transformer
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/mule-runtime/4.4/set-payload-transformer-reference.md
canonical_url: https://docs.mulesoft.com/mule-runtime/4.4/set-payload-transformer-reference
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 3e36418b3261fe95b0f4705c0f124b82a96b1bfd915a24d2d1ba1923a3f151f9
description: MuleSoft Documentation Site
release: "4.4"
latest: false
---
---
product: Mule Runtime
version: 4.4
keywords: anypoint studio, mule, set payload, payload
---

# Set Payload Transformer

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

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](https://docs.mulesoft.com/mule-runtime/4.4/transform-component-about) for complex scenarios.

<table><colgroup><col> <col> <col></colgroup><thead><tr><th>Field</th><th>Usage</th><th>Description</th></tr></thead><tbody><tr><td><p>Value (<code>value</code>)</p></td><td><p>Required</p></td><td><p>Accepts a literal string or DataWeave expression that defines how to set the payload, for example, <code>"some string"</code> or <code>#[now()]</code>.</p></td></tr><tr><td><p>Mime Type (<code>mimeType</code>)</p></td><td><p>Optional</p></td><td><p>The mime type of the value assigned to the payload, for example, <code>text/plain</code> or <code>application/json</code>.</p></td></tr><tr><td><p>Encoding (<code>encoding</code>)</p></td><td><p>Optional</p></td><td><p>The encoding of the value assigned to the payload, for example, <code>UTF-8</code>.</p></td></tr></tbody></table>

> [!WARNING] The `mimeType` and `encoding` attributes will not affect a DataWeave expression used as
> `value`. They only affect the output Mule Message. If a transformation is required, the DataWeave
> expression must contain an explicit output directive.

This XML example sets a payload with static values:

Static Content Example:

```xml
<set-payload value="{ 'name' : 'Ana', 'office' : 'BA' }" mimeType="application/json" encoding="UTF-8"/>
```

The next example sets the message payload to "Hello, World" appending today’s date using a DataWeave
expression: `#['Hello World!' ++ ' Today is ' ++ now()]`

Expression Content Example:

```xml
<set-payload value="#['Hello World!' ++ ' Today is ' ++ now()]"/>
```

## See Also

- [Mule Message Structure](https://docs.mulesoft.com/mule-runtime/4.4/about-mule-message)

- [DataWeave Language](https://docs.mulesoft.com/mule-runtime/4.4/dataweave)
