Nav

read

read(String | Binary, String, Object)

Reads the input content (string or binary) with a mimeType reader for the data format of the input and returns the result of parsing that content.

The first argument provides the content to read. The second is its format (or content type). The default content type is application/dw. A third, optional argument sets reader configuration properties.

For other formats and reader configuration properties, see Data Formats Supported by DataWeave.

Transform

        
     
1
2
3
4
%dw 2.0
output application/xml
---
 read('{"name":"DataWeave"}', "application/json")
Output

        
     
1
<name>DataWeave</name>