Contact Us 1-800-596-4880

DataWeave (dw) Format

MIME type: application/dw

ID: dw

The DataWeave (dw) format is the canonical format for all transformations. This format can help you understand how input data is interpreted before it is transformed to a new format.

This format is intended to help you debug the results of DataWeave transformations. It is significantly slower than other formats. It is not recommended to be used in production applications because it can impact the performance.

Example: Express XML in the DataWeave (dw) Format

The following example shows how to transform XML input to the DataWeave (dw) format.

Input

The example uses the following XML snippet as input.

<employees>
  <employee>
    <firstname>Mariano</firstname>
    <lastname>DeAchaval</lastname>
  </employee>
  <employee>
    <firstname>Leandro</firstname>
    <lastname>Shokida</lastname>
  </employee>
</employees>

Output

Output: in DataWeave Format
{
  employees: {
    employee: {
      firstname: "Mariano",
      lastname: "DeAchaval"
    },
    employee: {
      firstname: "Leandro",
      lastname: "Shokida"
    }
  }
} as Object {encoding: "UTF-8", mimeType: "text/xml"}

Configuration Properties

DataWeave supports the following configuration properties for this format.

Reader Properties

This format accepts properties that provide instructions for reading input data.

Parameter Type Default Description

externalResources

Boolean

false

Enables the readUrl to read external entities.

Valid values are true or false.

javaModule

Boolean

false

Enables Java module functions to load.

Valid values are true or false.

onlyData

Boolean

false

Handles only data and not other types of content, such as functions, when set to true. The DataWeave parser runs faster in the onlyData mode.

Valid values are true or false.

privileges

String

''

Accepts a comma-separated list of privileges to use in the format, such as 'Resources,Properties'.

Writer Properties

This format accepts properties that provide instructions for writing output data.

Parameter Type Default Description

bufferSize

Number

8192

Size of the buffer writer, in bytes. The value must be greater than 8.

deferred

Boolean

false

Generates the output as a data stream when set to true, and defers the script’s execution until the generated content is consumed.

Valid values are true or false.

ignoreSchema

Boolean

false

Ignores the schema when set to true.

Valid values are true or false.

indent

String

' '

String to use for indenting.

maxCollectionSize

Number

-1

Maximum number of elements allowed in an array or an object. -1 indicates no limitation.

onlyData

Boolean

true

Handles only data and not other types of content, such as functions, when set to true. The DataWeave parser runs faster in the onlyData mode.

Valid values are true or false.

Supported MIME Types

This format supports the following MIME types.

MIME Type

*/dw