---
schema_version: "1"
id: 2893615849ad5458d4acd54300294e0cfb8c7ceb7e093f64ddee62c6c38c312c
title: unionItems
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.3/dw-types-functions-unionitems.md
canonical_url: https://docs.mulesoft.com/dataweave/2.3/dw-types-functions-unionitems
source_site: docs.mulesoft.com
content_type: documentation
content_hash: ea47934bd5f4b146d7fb10791d425ee52f5dfafb489569d06a96c8042516ba61
description: MuleSoft Documentation Site
release: "2.3"
latest: false
---
---
product: DataWeave
version: 2.3
---

# unionItems

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

## unionItems(Type): Array<Type>

Returns an array of all the types that define a given Union type. This function fails if the input
is not a Union type.

_Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later._

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p>t</p></td><td><p>The type to check.</p></td></tr></tbody></table>

### Example

This example shows how `unionItems` behaves with different inputs.

#### Source

```DataWeave
%dw 2.0
import * from dw::core::Types
type AType = String | Number
output application/json
---
{
   a: unionItems(AType)
}
```

#### Output

```Json
{
  "a": ["String","Number"]
}
```
