Nav
You are viewing an older version of this section. Click here to navigate to the latest version.

DataWeave

DataWeave is a new feature of the 3.7 runtime that replaces the DataMapper, which is a major component in previous versions. We recommend you use DataWeave to avoid the future obsolescence of Datamapper.

The DataWeave language is a simple, powerful tool to query and transform data inside of Mule. It can be used in two different ways:

  • you can graphically map fields by dragging and dropping them, as could be done with the deprecated DataMapper

  • or you can leverage its powerful JSON-like language that’s purposely built to make writing transformations as fast as possible and highly maintainable over the long term. It supports a variety of transformations, from simple one-to-one mappings, to more elaborate mappings including normalization, grouping, joins, partitioning, pivoting and filtering.

The language is tightly integrated with Mule runtime and Anypoint Studio. Use the Transform Message component, that allows you to use the language to query and transform data through DataWeave. Any mappings you perform through the graphical interface will be expressed in DataWeave code in real time and vice versa. It fully supports DataSense, allowing you to leverage metadata from connectors, schemas and sample documents to more easily design your transformations. DataSense provides content assist while you are coding and scaffolds your mappings to help make writing transformations fast and easy.

The DataWeave language (which is similar to JSON) is used to describe the cannonical form of the data you want to see as an output. It works as a template engine, producing the output by filling in the references and executing the functions that you place inline with the the structure description.

If you have projects that are built with the deprecated DataMapper, a migration tool is now included in Studio, which assists in converting a DataMapper map to DataWeave: Right click on a DataMapper, select Migrate to DataWeave, and follow the instructions.

dw migrator