DataWeave Support in Flex Gateway Policies | MuleSoft Documentation
# DataWeave Support in Flex Gateway Policies
DataWeave is the programming language designed by MuleSoft for data transformation. It enables you to build a simple solution for a common integration developer use case: read and parse data from one format, transform the data, and write it out as a different format.
Flex Gateway supports a subset of DataWeave in policy configuration expressions. DataWeave is only supported in included policies and custom policies created with PDK..
## Available Types
  * `Boolean`
  * `Number` (Driven as 64 bits floating points)
  * `Object` (Repeated keys are not available)


## Available Value Constructors for Types


## Unavailable Value Constructors for Types
  * (Writing a `null` literal is not supported)
  * `Object` (Objects can not be defined as literals)


## Available Flow Control Structures
## Unavailable Flow Control Structures
## Available Selectors
  * `Array[Number]`
  * `Array[String]`
  * `Object[String]`
  * `String[Number]`


## Unavailable Selectors
  * `Object[Number]`


## Available Equality and Relational Operators
## Available Logical Operators
## Available Default Operators
## Available Functions
  * `++(Array<S>, Array<T>): Array<S | T>`
  * `++(String, String): String`


### `contains`
  * `contains(Array<T>, Any): Boolean`
  * `contains(String, String): Boolean`


### `lower`
  *   * 

### `splitBy`
  * `splitBy(String, String): Array<String>`


### `sizeOf`
  * `sizeOf(Array<Any>): Number`
  *   * 

  *   * 

### `upper`
  *   * 

  * 

### `dw::core::Strings::substringAfter`
  * `substringAfter(String, String): String`
  * `substringAfter(Null, String): Null`


### `dw::core::Strings::substringAfterLast`
  * `substringAfterLast(String, String): String`
  * `substringAfterLast(Null, String): Null`


### `dw::core::Strings::substringBefore`
  * `substringBefore(String, String): String`
  * `substringBefore(Null, String): Null`


### `dw::core::Strings::substringBeforeLast`
  * `substringBeforeLast(text: String, separator: String): String`
  * `substringBeforeLast(text: Null, separator: String): Null`


### toBase64
  * `toBase64(content: Binary): String`


### fromBase64
  * `fromBase64(base64String: String): Binary`


Flex Gateway doesn’t support DataWeave expressions with binary type results. To use the `dw::Binaries::fromBase64('dXNlcjpwYXNz')` function, transform the result to a string. Transform the binary output to a string with the `dw::util::Coercions::toString(binary: Binary, encoding: String): String` function. For example, `[dw::util::Coercions::toString(dw::core::Binaries::fromBase64('dXNlcjpwYXNz'), 'UTF-8')]`. If using a different function that transforms the binary by default, such as `[splitBy(dw::core::Binaries::fromBase64('dXNlcjpwYXNz'), ':')]`, you can skip manually transforming the binary.  
---  
### toBinary
  * `toBinary(str: String, encoding: String): Binary`


### toString
  * `toString(binary: Binary, encoding: String): String`


## Available Predefined Variables
  *     * `attributes.headers`
    * `attributes.method` (Only available in request context)
    * `attributes.queryParams` (Only available in request context)
    * `attributes.queryString` (Only available in request context)
    * `attributes.requestPath` (Only available in request context)
    * `attributes.requestUri` (Only available in request context)
    * `attributes.localAddress` (Only available in request context)
    * `attributes.remoteAddress` (Only available in request context)
    * `attributes.scheme` (Only available in request context)
    * `attributes.version` (Only available in request context)
    * `attributes.statusCode` (Only available in response context)
  *     * `authentication.clientId`
    * `authentication.clientName`
    * `authentication.principal`
    * `authentication.properties`
  * `payload`
    * Fields depend on the current payload. For example, `#[payload]` returns the body of the message.
  *     * Individual policies support different sets of variables. For information, refer to the policies listed in Inbound Policies Directory.