---
schema_version: "1"
id: e95df666529085642582a14a4767ed10b6741781c52a3b81e8a94e3287fc0cdd
title: YAML Format
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.6/dataweave-formats-yaml.md
canonical_url: https://docs.mulesoft.com/dataweave/2.6/dataweave-formats-yaml
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 9bc2932e95bbf4d45fae672f2f0e21bfb7dc924f447f65e41b13bae65c5792ee
description: MuleSoft Documentation Site
release: "2.6"
latest: false
---
---
product: DataWeave
version: 2.6
keywords: format, yaml, application/yaml, text/yaml, application/x-yaml, text/x-yaml, application/yaml
---

# YAML Format

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

MIME type: `application/yaml`

ID: `yaml`

Values in the YAML data format map one-to-one with DataWeave values. DataWeave natively supports all
of the following YAML types:

- `String`

- `Boolean`

- `Number`

- `Nil`

- `Mapping`

- `Sequences`

## Example: Represent YAML in the DataWeave Format (dw)

This example shows how DataWeave represents YAML values.

### Input

The following YAML snippet serves as the input payload for the DataWeave source in this example.

```yaml
american:
  - Boston Red Sox
  - Detroit Tigers
  - New York Yankees
national:
  - New York Mets
  - Chicago Cubs
  - Atlanta Braves
```

### Source

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

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

### Output

The following output shows how the YAML input is represented in the DataWeave (`dw`) format.

```dataweave
{
  "american": [
    "Boston Red Sox",
    "Detroit Tigers",
    "New York Yankees"
  ],
  "national": [
    "New York Mets",
    "Chicago Cubs",
    "Atlanta Braves"
  ]
}
```

## Configuration Properties

DataWeave supports the following configuration properties for this format.

### Reader Properties

This format accepts properties that provide instructions for reading input 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>maxEntityCount</code></p></td><td><p><code>Number</code></p></td><td><p><code>1</code></p></td><td><div><div><p>Sets the maximum number of entity expansions. The limit helps avoid Billion Laughs attacks.</p></div></div></td></tr></tbody></table>

### Writer Properties

This 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 buffer writer, in bytes. The value must be greater than <code>8</code>.</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>Generates the output as a data stream when set to <code>true</code>, and defers the script’s execution until the generated content is consumed.</p></div><div><p>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>'UTF-8'</code></p></td><td><div><div><p>The encoding to use for the output, such as UTF-8.</p></div></div></td></tr><tr><td><p><code>skipNullOn</code></p></td><td><p><code>String</code></p></td><td><p><code>null</code></p></td><td><div><div><p>Skips <code>null</code> values in the specified data structure. By default, DataWeave does not skip the values.</p></div><div><ul><li><p><code>arrays</code> + Ignore and omit <code>null</code> values inside arrays from the YAML output, for example, with <code>output application/yaml skipNullOn="arrays"</code>.</p></li><li><p><code>objects</code> + Ignore key-value pairs that have <code>null</code> as the value, for example, with <code>output application/yaml skipNullOn="objects"</code>.</p></li><li><p><code>everywhere</code> + Apply <code>skipNullOn</code> to arrays and objects, for example, <code>output application/yaml skipNullOn="everywhere"</code>.</p></li></ul></div><div><p>Valid values are <code>arrays</code> or <code>objects</code> or <code>everywhere</code>.</p></div></div></td></tr><tr><td><p><code>writeDeclaration</code></p></td><td><p><code>Boolean</code></p></td><td><p><code>true</code></p></td><td><div><div><p>Indicates whether to write the header declaration or not.</p></div><div><p>Valid values are <code>true</code> or <code>false</code>.</p></div></div></td></tr></tbody></table>

## Supported MIME Types

This format supports the following MIME types.

<table><colgroup><col></colgroup><thead><tr><th>MIME Type</th></tr></thead><tbody><tr><td><p><code>application/yaml</code></p></td></tr><tr><td><p><code>text/yaml</code></p></td></tr><tr><td><p><code>application/x-yaml</code></p></td></tr><tr><td><p><code>text/x-yaml</code></p></td></tr></tbody></table>
