# How to convert array to String

**URL:** <https://community.dynatrace.com/t/how-to-convert-array-to-string/52986>\
**Category:** DQL\
**Tags:** dql, notebooks\
**Created:** [August 17, 2025, 12:01pm UTC](https://community.dynatrace.com/t/how-to-convert-array-to-string/52986 "2025-08-17T12:01:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![deni](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/deni/32/163_2.png) [@deni](https://community.dynatrace.com/u/deni)\
**Post date:** [August 17, 2025, 12:01pm UTC](https://community.dynatrace.com/t/how-to-convert-array-to-string/52986/1 "2025-08-17T12:01:24Z")

</div>

Hi,

From one of the tasks of the DQL course in university:

# Data Types

Starting with the below DQL Query, what data type are the following fields:

- related\_entity\_ids
- dt.davis.is\_duplicate
- event.start

Afterwards, modify the query to cast the k8s.container.name field to a String.

I checked the requested types and the type of the k8s.container.name is an array. I tried the following:

```markup
fetch events
| filter event.kind == "DAVIS_PROBLEM"
| fields k8s.container.name
| filterOut isNull(k8s.container.name)
| fieldsAdd test = asString(k8s.container.name)

```

The value of the test column is null. I searched in the documentation, but didn’t find anything like arrayToString(arr, delimiter) or similar.

Can you help me with this?

Regards, Deni

---

<div class="post-metadata">

**Author:** ![krzysztof\_hoja](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/krzysztof_hoja/32/34625_2.png) [@krzysztof\_hoja](https://community.dynatrace.com/u/krzysztof_hoja)\
**Post date:** [August 17, 2025, 6:04pm UTC](https://community.dynatrace.com/t/how-to-convert-array-to-string/52986/2 "2025-08-17T18:04:45Z")

</div>

Unfortunately there is no function where you can specify new delimiter. There is however toString function. This example should explain how it works and how to achieve what you need:

```markup
data record(arr=array("s1","s2","s3"))
| fieldsAdd merged = toString(arr)
| fieldsAdd merged2 = replaceString(merged,"""["""","")
| fieldsAdd merged2 = replaceString(merged2,""""]""","")
| fieldsAdd merged2 = replaceString(merged2,"""", """","/")

```

 ![krzysztof_hoja_0-1755453841284.png](https://global.discourse-cdn.com/dynatrace/original/3X/1/6/16ed1bad09fbe9b3455e2814b6b4efc598151eae.png)

---

<div class="post-metadata">

**Author:** ![deni](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/deni/32/163_2.png) [@deni](https://community.dynatrace.com/u/deni)\
**Post date:** [August 17, 2025, 6:54pm UTC](https://community.dynatrace.com/t/how-to-convert-array-to-string/52986/3 "2025-08-17T18:54:41Z")

</div>

Ahaaa, I tried asString, but now I see in the documentation that all as… functions just verify the type and return null otherwise. If I want to cast, I need to use the to… functions — in this case toString.

Thanks also for the extra tips on how to set a custom delimiter 🙂
