# Array to string

**URL:** <https://forum.servoy.com/t/array-to-string/8751>\
**Category:** Classic Servoy\
**Created:** [February 18, 2008, 1:16pm UTC](https://forum.servoy.com/t/array-to-string/8751 "2008-02-18T13:16:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![irenem](https://avatars.discourse-cdn.com/v4/letter/i/977dab/32.png) [@irenem](https://forum.servoy.com/u/irenem)\
**Post date:** [February 18, 2008, 1:16pm UTC](https://forum.servoy.com/t/array-to-string/8751/1 "2008-02-18T13:16:51Z")

</div>

I try to convert an array to a string with the values separated by a return.

```auto
var test = new Array("text1","text2","text3")
test.join("\n")
application.output(test);

```

What I want is something like:

“text1  
text2  
text3”

All I get is : [Ljava.lang.Object;@50d549

what am I doing wrong?

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [February 18, 2008, 1:27pm UTC](https://forum.servoy.com/t/array-to-string/8751/2 "2008-02-18T13:27:07Z")

</div>

try this:

```auto
var test = new Array("text1","text2","text3")
application.output(test.join("\n"));

```

---

<div class="post-metadata">

**Author:** ![irenem](https://avatars.discourse-cdn.com/v4/letter/i/977dab/32.png) [@irenem](https://forum.servoy.com/u/irenem)\
**Post date:** [February 18, 2008, 1:32pm UTC](https://forum.servoy.com/t/array-to-string/8751/3 "2008-02-18T13:32:32Z")

</div>

this works great, thank you

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [February 18, 2008, 2:05pm UTC](https://forum.servoy.com/t/array-to-string/8751/4 "2008-02-18T14:05:33Z")

</div>

The join method creates and returns a string. You have not assigned this anywhere, so outputting “test” just outputs the array. Next to Harjo’s solution you could also have written this

var test = new Array(“text1”,“text2”,“text3”)  
test = test.join(“\n”);  
application.output(test);

---

<div class="post-metadata">

**Author:** ![irenem](https://avatars.discourse-cdn.com/v4/letter/i/977dab/32.png) [@irenem](https://forum.servoy.com/u/irenem)\
**Post date:** [February 20, 2008, 9:45am UTC](https://forum.servoy.com/t/array-to-string/8751/5 "2008-02-20T09:45:18Z")

</div>

Thanks Patrick, this makes things clear.
