# Data Binding Multi-Dimensional Arrays

**URL:** <https://forum.builder.io/t/data-binding-multi-dimensional-arrays/93>\
**Category:** Technical Questions\
**Created:** [May 26, 2020, 4:11am UTC](https://forum.builder.io/t/data-binding-multi-dimensional-arrays/93 "2020-05-26T04:11:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bull1099](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/bull1099/32/88_2.png) [@bull1099](https://forum.builder.io/u/bull1099)\
**Post date:** [May 26, 2020, 4:11am UTC](https://forum.builder.io/t/data-binding-multi-dimensional-arrays/93/1 "2020-05-26T04:11:50Z")

</div>

I am having some difficulties trying to data bind an array element inside another array. Is this possible? I feel like this is common.

I am using a fetch to hit my API inside the “Data → Edit JS + CSS” feature. I am successfully capturing the response.

Sample Response

> ```
> {
> user: {
> name: Blake,
> nickname: Bull
> },
> favorites: [
> {
> id: 1,
> name: colors,
> items: [
> {
> id: 3820,
> name: red
> },
> {
> id: 3821,
> name: blue
> }
> ]
> }
> ]
> }
> 
> ```

How can I loop and data bind to favorites.items … to display values Red and Blue ?

---

<div class="post-metadata">

**Author:** ![aziz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/aziz/32/2551_2.png) [@aziz](https://forum.builder.io/u/aziz)\
**Post date:** [May 26, 2020, 8:10pm UTC](https://forum.builder.io/t/data-binding-multi-dimensional-arrays/93/2 "2020-05-26T20:10:26Z")

</div>

Builder provides number of helpful properties on it’s state for each block in a repeat, so if you’re doing a repeat on a state.results , you’ll get under it , `$resultsItem` , and `$resultsIndex` and those will be available for any repeat under that.  
I created a fiddle that loops through an array of arrays, to inspect the object you can see it in the data tag \> edit content JS + CSS (scroll till the end)

> **[Builder: Drag and drop page building for any site](https://builder.io/fiddle/33448f3de46d4444ba9ce73b9adb53bc)**
>
> Builder is the first and only headless CMS with full visual drag and drop editing

If you want to see how’s the repeats happening, please go through the layers in the layers tab, and you’ll see a repeat icon, that you can click and see what is being repeated for that layer.

 ![Screen Shot 2020-05-26 at 1.08.58 PM](https://us1.discourse-cdn.com/flex020/uploads/builder/original/1X/cbf97e7fe7607e42f33e9caf1720da44c785d08e.png)

---

<div class="post-metadata">

**Author:** ![bull1099](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/bull1099/32/88_2.png) [@bull1099](https://forum.builder.io/u/bull1099)\
**Post date:** [May 27, 2020, 12:00am UTC](https://forum.builder.io/t/data-binding-multi-dimensional-arrays/93/3 "2020-05-27T00:00:55Z")

</div>

Marked as solved!

First loop will repeat on state.favorites  
Second loop will repeat on state.favoritesItem.items … state.favoritesItem is set from first loop.

Thank you

---

<div class="post-metadata">

**Author:** ![asriram](https://avatars.discourse-cdn.com/v4/letter/a/f08c70/32.png) [@asriram](https://forum.builder.io/u/asriram)\
**Post date:** [November 1, 2022, 8:58pm UTC](https://forum.builder.io/t/data-binding-multi-dimensional-arrays/93/4 "2022-11-01T20:58:04Z")

</div>

Hi, I’m trying to do something similar but I have already extracted the json data into state.listingsArray as follows:  
[{  
address: “125 Main St”,  
price: 1200000  
}, {  
address: “7620 197th Street SE”,  
price: 1225000  
}, {  
address: “9603 Avenue M”,  
price: 899999  
}, {  
address: “904 Chestnut Street”,  
price: 129900  
}]

But my question is how do I do a repeat over this to display a list of the addresses (as text fields)?

I tried doing “Repeat for each state.listingsArray” but I can’t display each address without an index…

---

<div class="post-metadata">

**Author:** ![sarah](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/sarah/32/1198_2.png) [@sarah](https://forum.builder.io/u/sarah)\
**Post date:** [November 1, 2022, 9:17pm UTC](https://forum.builder.io/t/data-binding-multi-dimensional-arrays/93/5 "2022-11-01T21:17:32Z")

</div>

Hi @asriram, to access the index within a repeated element, you can use `state.$index`. However, you should be able to bind the address to text within a repeating element without this.

---

<div class="post-metadata">

**Author:** ![asriram](https://avatars.discourse-cdn.com/v4/letter/a/f08c70/32.png) [@asriram](https://forum.builder.io/u/asriram)\
**Post date:** [November 1, 2022, 9:45pm UTC](https://forum.builder.io/t/data-binding-multi-dimensional-arrays/93/6 "2022-11-01T21:45:32Z")

</div>

Oh yes, got it! Thanks a lot @sarah !!
