# DataWeave output formats, readers and writers

*MuleSoft Developer Study Guide · Transforming Data · Last updated October 28, 2026 · https://www.certifyforce.com/study-guide/mulesoft-developer/transforming-data/dataweave-output-formats-readers-and-writers*

How the output directive picks a DataWeave writer and MIME type, how `with` reports a custom MIME type such as application/problem+json, where reader properties (on a source's outputMimeType) and writer properties (on the output directive) go, how CSV input is represented, and which writer DataWeave uses when a script has no output directive.

- Certification: Salesforce MuleSoft Developer
- Exam section: Transforming Data
- Study guide: https://www.certifyforce.com/study-guide/mulesoft-developer

**Official exam objective:**

> Convert between output types and data types using DataWeave.

## What the exam expects

- Write the `output` directive that selects the right writer (JSON, CSV, XML, Java) and append writer properties such as the CSV `separator` and `header` or the JSON `skipNullOn`.
- Report a custom MIME type such as `application/problem+json` while a standard writer formats the body, using `with`.
- Tell reader properties (on a listener or Read operation's `outputMimeType`) from writer properties (on the `output` directive), and predict what each one changes.
- Predict how CSV input is represented in DataWeave and what a JSON writer prints for it.
- Predict the data type of an expression that has no `output` directive, such as a literal in Set Payload.
- Key terms: **output directive** (header line that names the output MIME type or format ID); **writer** (format-specific serializer of the script's result); **reader** (format-specific parser of an input); **reader/writer properties** (format-specific settings appended to a MIME type or directive); **format ID** (short name such as `json`, `csv`, `java`); **TypedValue** (Mule's value plus data type, i.e. MIME type and encoding).

## Key facts

| Fact | Detail | Source |
|---|---|---|
| Format ID in the directive | Since Mule 4.3.0, `output json` works as well as `output application/json` | [Supported Data Formats](https://docs.mulesoft.com/dataweave/latest/dataweave-formats) |
| Custom MIME type | `output application/problem+json with json`: MIME type first, writer after `with` | [Change a Script's MIME Type Output](https://docs.mulesoft.com/dataweave/latest/dataweave-cookbook-change-script-output-mime) |
| HTTP Content-Type | HTTP uses the script's MIME type to generate its `Content-Type` header | [Change a Script's MIME Type Output](https://docs.mulesoft.com/dataweave/latest/dataweave-cookbook-change-script-output-mime) |
| CSV writer defaults | `separator` = `,`, `header` = `true`, `quoteValues` = `false` | [CSV Format](https://docs.mulesoft.com/dataweave/latest/dataweave-formats-csv) |
| CSV values | Read as Strings; rows are objects keyed by the header | [CSV Format](https://docs.mulesoft.com/dataweave/latest/dataweave-formats-csv) |
| CSV reader memory | In memory up to 1.5 MB, on disk above; `streaming=true` for sequential access | [CSV Format](https://docs.mulesoft.com/dataweave/latest/dataweave-formats-csv) |
| `skipNullOn` values | `arrays`, `objects`, `everywhere`; default skips nothing | [JSON Format](https://docs.mulesoft.com/dataweave/latest/dataweave-formats-json) |
| Reader properties | Appended to a listener's or Read operation's `outputMimeType`; never transform | [Supported Data Formats](https://docs.mulesoft.com/dataweave/latest/dataweave-formats) |
| No input, no directive | Java writer; `#[{a: true}]` becomes a `java.util.Map` | [Mule Data Types](https://docs.mulesoft.com/mule-runtime/latest/mule-data-types) |
| Mixed input types | Inputs of different data types with no directive throw an error | [Mule Data Types](https://docs.mulesoft.com/mule-runtime/latest/mule-data-types) |
| `dw` format | Canonical debug format; significantly slower, not for production | [DataWeave (dw) Format](https://docs.mulesoft.com/dataweave/latest/dataweave-formats-dw) |

## Check yourself

- When does the CSV reader keep a file on disk instead of in memory, and what lets you stream it?
- When should a script use `with` in its output directive?
- What does `<set-payload value="#[{a: true}]"/>` produce?
- Which `skipNullOn` value removes nulls from both objects and arrays?
- Why is `output application/dw` kept out of production flows?

## Sources

- [Supported Data Formats](https://docs.mulesoft.com/dataweave/latest/dataweave-formats)
- [CSV Format](https://docs.mulesoft.com/dataweave/latest/dataweave-formats-csv)
- [JSON Format](https://docs.mulesoft.com/dataweave/latest/dataweave-formats-json)
- [Change a Script's MIME Type Output](https://docs.mulesoft.com/dataweave/latest/dataweave-cookbook-change-script-output-mime)
- [Mule Data Types](https://docs.mulesoft.com/mule-runtime/latest/mule-data-types)
- [Java Format](https://docs.mulesoft.com/dataweave/latest/dataweave-formats-java)
- [DataWeave (dw) Format](https://docs.mulesoft.com/dataweave/latest/dataweave-formats-dw)
- [Type Coercion with DataWeave](https://docs.mulesoft.com/dataweave/latest/dataweave-types-coercion)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit, its 6 linked practice questions, and unlimited timed mock exams are included with the MuleSoft Developer pack (USD $19): https://www.certifyforce.com/practice-exams
