# Loop over array of strings

**URL:** <https://forums.fusetools.com/t/loop-over-array-of-strings/4066>\
**Category:** How-to Discussions\
**Created:** [August 31, 2016, 5:27am UTC](https://forums.fusetools.com/t/loop-over-array-of-strings/4066 "2016-08-31T05:27:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Erick\_Tamayo](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/erick_tamayo/32/527_2.png) [@Erick\_Tamayo](https://forums.fusetools.com/u/Erick_Tamayo)\
**Post date:** [August 31, 2016, 5:27am UTC](https://forums.fusetools.com/t/loop-over-array-of-strings/4066/1 "2016-08-31T05:27:16Z")

</div>

Hello I’m trying how to implement an Each clause if I have an array of strings instead of objects, for example:

````json
 {
        "name": "Header",
        "contents": [
          "Text 1",
          "Text 2",
          "Text 3",
          "Text 4"
        ]
 }```

I'm trying to display *Text 1* to *Text 4* it inside a `Text` component.
````

---

<div class="post-metadata">

**Author:** ![Uldis](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/uldis/32/657_2.png) [@Uldis](https://forums.fusetools.com/u/Uldis)\
**Post date:** [August 31, 2016, 8:44am UTC](https://forums.fusetools.com/t/loop-over-array-of-strings/4066/2 "2016-08-31T08:44:56Z")

</div>

Hi Erick,  
there are several things you have to make sure you do:

1. Make the array accessible to UX by adding it to your _module.exports_. Either export the whole object you have there, or map to the inner array directly, it doesn’t make a huge difference. Something like this should do:

```auto
var obj = {
    "name":"Header",
    "contents": [
        "Text 1",
        "Text 2",
        "Text 3",
        "Text 4"
    ]
};
module.exports = {
    "myobject":obj
};

```

1. In your UX, data-bind your _Each_ to the exported array:

```auto
<Each Items="{myobject.contents}">
    <!-- ... -->
</Each>

```

1. And for the last thing on this, if you want to access a literal value inside of an array, you have to reference that with simple empty curly braces, like this:

```auto
<Each Items="{myobject.contents}">
    <Text Value="{}" />
</Each>

```

You might also want to enclose your _Each_ within a _StackPanel_ to keep the items neatly stacked on top of each other, but let’s leave this for you to figure out further.

---

<div class="post-metadata">

**Author:** ![Erick\_Tamayo](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/erick_tamayo/32/527_2.png) [@Erick\_Tamayo](https://forums.fusetools.com/u/Erick_Tamayo)\
**Post date:** [August 31, 2016, 1:56pm UTC](https://forums.fusetools.com/t/loop-over-array-of-strings/4066/3 "2016-08-31T13:56:35Z")

</div>

It worked! Thanks!
