---
schema_version: "1"
id: d2f8b2d6ecd7b195cee6e70fec77e8d29d84652cc3a8c40f83846f6e916a385a
title: URL Encoded Format
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.3/dataweave-formats-urlencoded.md
canonical_url: https://docs.mulesoft.com/dataweave/2.3/dataweave-formats-urlencoded
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 3f3185bb46738483d4fc92c8e85f73658ac9472d90c2169930f13a317d4c47ac
description: MuleSoft Documentation Site
release: "2.3"
latest: false
---
---
product: DataWeave
version: 2.3
---

# URL Encoded Format

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

MIME Type: `application/x-www-form-urlencoded`

ID: `urlencoded`

URL encoded data represents a collection of key-value pairs. DataWeave represents these values as an
object in which each value is a string.

## Examples

The following examples show uses of the URL Encoded format:

- [Example: Represent URL Encoded Data in the DataWeave (dw) Format](#example1)

- [Example: Generate URL Encoded Data from a JSON Object](#example2)

- [Example: Generate URL Encoded Data from a Collection of Key-Value Pairs](#example3)

- [Example: Transform URL Encoded Data to the Text Plain Format](#example4)

### Example: Represent URL Encoded Data in the DataWeave (dw) Format

This example shows how DataWeave represents simple URL encoded data.

#### Input

The URL encoded data serves as input payload to the DataWeave source.

```form-urlencoded
name=Mariano&lastName=de+Achaval
```

#### Source

The DataWeave script transforms the URL encoded input payload to the DataWeave (dw) format and MIME
type.

```dataweave
%dw 2.0
output application/dw
---
payload
```

#### Output

The output is a DataWeave object that contains a collection of key-value pairs from the input.

```dataweave
{
    "name": "Mariano",
    "lastName": "de Achaval"
}
```

### Example: Generate URL Encoded Data from a JSON Object

This example shows how to generate URL Encoded data.

### Input

The JSON object serves as the input payload to the DataWeave source.

```json
{
  "name": "Mariano"
}
```

#### Source

The DataWeave script selects the value of the `name` key in the input payload and transforms all
values of the object in the body of the script to the `urlencoded` format.

```dataweave
%dw 2.0
output urlencoded
---
{
    name: payload.name,
    age: 37
}
```

#### Output

The output is URL encoded data that is constructed from the key-value pairs in the body of the
DataWeave script.

```form-urlencoded
name=Mariano&age=37
```

### Example: Generate URL Encoded Data from a Collection of Key-Value Pairs

This DataWeave script produces the URL encoded output.

#### Source

The DataWeave script transforms the format of the JSON input found within the body of the script
into the URL Encoded format.

```dataweave
%dw 2.0
output application/x-www-form-urlencoded
---
{
  "key" : "value",
  "key 1": "@here",
  "key" : "other value",
  "key 2%": null
}
```

#### Output

The output shows the input data in the URL Encoded format.

```text
key=value&key+1=%40here&key=other+value&key+2%25
```

### Example: Transform URL Encoded Data to the Text Plain Format

This example transforms URL Encoded input into the Text Plain format and MIME type.

#### Source

The DataWeave script reads the URL Encoded data and concatenates values of the selected keys.

```dataweave
%dw 2.0
var myData  read('key=value&key+1=%40here&key=other+value&key+2%25', 'application/x-www-form-urlencoded')
output text/plain
---
myData.*key[0] ++ myData.'key 1'
```

#### Output

The output is in Text Plain format.

```text
value@here
```

## Configuration Properties

DataWeave supports the following configuration properties for the URL Encoded format.

### Reader Properties (for URL Encoded Data)

There are no reader properties for URL encoded data.

### Writer (for URL Encoded Data)

The URL Encoded format accepts properties that provide instructions for writing output data.

<table><colgroup><col> <col> <col> <col></colgroup><thead><tr><th>Parameter</th><th>Type</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td><p><code>bufferSize</code></p></td><td><p><code>Number</code></p></td><td><p><code>8192</code></p></td><td><div><div><p>Size of the writer buffer.</p></div></div></td></tr><tr><td><p><code>deferred</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>false</code></p></td><td><div><div><p>When set to <code>true</code>, DataWeave generates the output as a data stream, and the script’s execution is deferred until it is consumed. Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr><tr><td><p><code>encoding</code></p></td><td><p><code>String</code></p></td><td><p><code>null</code></p></td><td><div><div><p>Encoding for the writer to use.</p></div></div></td></tr></tbody></table>

## Supported MIME Types

The URL Encoded format supports the following MIME types.

<table><colgroup><col></colgroup><thead><tr><th>MIME Type</th></tr></thead><tbody><tr><td><p><code>application/x-www-form-urlencoded</code></p></td></tr></tbody></table>
