Contact Free trial Login

DataWeave Format (dw)

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 the DataWeave (dw) format.

Reader Properties (for dw)

The DataWeave (dw) format accepts properties that provide instructions for reading input data.

Parameter Type Default Description

externalResources

Boolean

false

Enables reading external entities on readUrl. Valid options are true or false.

javaModule

Boolean

false

Enables you to load Java module functions. Valid options are true or false.

onlyData

Boolean

true

Indicates whether to handle data only and not other types of content, such as functions. Valid options are true or false. Note that the parser runs faster in the onlyData mode.

Writer Properties (for dw)

The DataWeave (dw) format accepts properties that provide instructions for writing output data.

Parameter Type Default Description

bufferSize

Number

8192

Size of the writer buffer.

deferred

Boolean

false

Property for deferred output. Valid values are true or false.

ignoreSchema

Boolean

false

Flag that indicates whether the DataWeave writer ignores the schema. Valid values are true or false.

indent

String

' '

The string to use for indentation.

maxCollectionSize

Number

-1

The maximum number of elements allowed in an array or object. -1 indicates that no limitation is set.

onlyData

Boolean

true

Indicates whether to handle data only and not other types of content, such as functions. Valid options are true or false. Note that the parser runs faster in the onlyData mode.

Supported MIME Types (for dw)

The DataWeave (dw) format supports the following MIME types.

MIME Type

*/dw

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub