---
schema_version: "1"
id: e76c587da33b468cb938cc6ff935435af368549d7244d7ab45563de614197de5
title: toArray
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.6/dw-coercions-functions-toarray.md
canonical_url: https://docs.mulesoft.com/dataweave/2.6/dw-coercions-functions-toarray
source_site: docs.mulesoft.com
content_type: documentation
content_hash: a6602293867fad7434252807448245af9d05b43c638c83ac9a3e24024482881e
description: MuleSoft Documentation Site
release: "2.6"
latest: false
---
---
product: DataWeave
version: 2.6
---

# toArray

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

## toArray(@StreamCapable text: String): Array<String>

Splits a `String` value into an `Array` of characters.

_Introduced in DataWeave version 2.4.0._

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>text</code></p></td><td><p>The <code>String</code> value to transform into an <code>Array</code> of characters (a <code>Array&lt;String&gt;</code> type).</p></td></tr></tbody></table>

### Example

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

#### Source

```DataWeave
%dw 2.0
import * from dw::util::Coercions
output application/json indent=false
---
{
  a: toArray(""),
  b: toArray("hola")
}
```

#### Output

```Json
{"a": [],"b": ["h","o","l","a"]}
```
