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

# 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"]}
```
