---
schema_version: "1"
id: 993f4185319e20ce076c3e0cea85cd4dba0481d02b128ec6aa77d9c20ddd5c86
title: "Introduction to Mule 4: DataWeave Expression Language"
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/mule-runtime/4.3/intro-expressions.md
canonical_url: https://docs.mulesoft.com/mule-runtime/4.3/intro-expressions
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 1e3016637b72655a9a057846013d594b25eceb6fd4b5d2f3f8d98b571295360b
description: MuleSoft Documentation Site
release: "4.3"
latest: false
---
---
product: Mule Runtime
version: 4.3
---

# Introduction to Mule 4: DataWeave Expression Language

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

In Mule 3, you must learn both the Mule Expression Language (MEL) and DataWeave. MEL forces you to
convert your payloads from binary data (such as XML or JSON documents) into Java objects so that you
can write expressions that access that data, for example, when routing to a specific location.

In Mule 4, DataWeave is the default expression language. Combined with the built-in streaming
capabilities, this change simplifies many common tasks:

- Events can be routed based on payload data, without requiring conversion to Java objects.

- Binary data can easily be queried from an expression anywhere in your flow, for example, when
  logging.

- Streaming now happens transparently. You no longer need to worry about larger-than-memory data
  streams or about consuming a stream twice.

DataWeave 2.0 also features many improvements, which are covered in the
[DataWeave 2.0](https://docs.mulesoft.com/mule-runtime/4.3/intro-dataweave2) section.

At the core, expressions continue to work as before. You can use them to extract data, log data, or
make decisions about where to route data. And like MEL, the syntax to access properties in your data
is very simple.

```xml
<logger message="#[payload]"/>
<set-variable variableName="httpResponseStatus" value="#[attributes.statusCode]"/>
```

Unlike MEL, you can use DataWeave to easily access data anywhere in your flow without concern for
transforming it into intermediate objects. Consider this example in Mule 3:

```xml
<http:listener path="/hello"/> <!-- receives a JSON HTTP Body -->
<json:json-to-object/> <!-- convert to Java objects -->
<choice> <!-- route data based on the data -->
  <when expression="#[payload.customer == 'Acme, Inc']">
    <!-- do some logic -->
  </when>
</choice>
```

In Mule 4, you no longer need to convert JSON to an intermediate format. You can simply access the
data directly through expressions without losing the original underlying data, and Mule 4 handles
all data streaming and random access transparently for you.

```xml
<http:listener path="/hello"/> <!-- receives a JSON HTTP Body -->
<choice> <!-- route data based on the data -->
  <when expression="#[payload.customer == 'Acme, Inc']">
    <!-- do some logic -->
  </when>
</choice>
```

## See Also

[Transformations and Streaming](https://docs.mulesoft.com/mule-runtime/4.3/intro-transformations)

[Migrating from DataWeave 1.0 to 2.x](https://docs.mulesoft.com/mule-runtime/4.3/migration-dataweave)

[DataWeave Language](https://docs.mulesoft.com/mule-runtime/4.3/dataweave)
