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.
Note
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.
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: 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.
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’. |
This format accepts properties that provide instructions for writing output data.
Parameter | Type | Default | Description |
bufferSize | Number | 8192 | Size of the buffer writer. |
deferred | Boolean | false | Generates the output as a data stream when set to true, and defers the script’s execution until 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. |
This format supports the following MIME types.
MIME Type |
*/dw |
If you like my post please follow me to read my latest post on programming and technology.
Problem Statement: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Example…
Given an integer A. Compute and return the square root of A. If A is…
Given a zero-based permutation nums (0-indexed), build an array ans of the same length where…
A heap is a specialized tree-based data structure that satisfies the heap property. It is…
What is the Lowest Common Ancestor? In a tree, the lowest common ancestor (LCA) of…