# How to loop through a nested array in liquid syntax

**URL:** <https://talk.jekyllrb.com/t/how-to-loop-through-a-nested-array-in-liquid-syntax/3771>\
**Category:** Help\
**Created:** [January 2, 2020, 5:32pm UTC](https://talk.jekyllrb.com/t/how-to-loop-through-a-nested-array-in-liquid-syntax/3771 "2020-01-02T17:32:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![devBhairavi](https://avatars.discourse-cdn.com/v4/letter/d/ee7513/32.png) [@devBhairavi](https://talk.jekyllrb.com/u/devBhairavi)\
**Post date:** [January 2, 2020, 5:32pm UTC](https://talk.jekyllrb.com/t/how-to-loop-through-a-nested-array-in-liquid-syntax/3771/1 "2020-01-02T17:32:44Z")

</div>

I am accessing the data from a json file from _\_data_ folder, I have this json data

```
{ 
   "content":[ 
      [ 
         "Unit I - Basic Principles of Electricity",
         "Introduction to basic principles of electricity - Classifications of materials - Basic "
      ],
      [ 
         "Unit II - Work, Power and Energy",
         "Work - Force - SI unit - Problem. Power, Energy - Electrical power - Electrical energy - "
      ]
   ]
}

```

An array holding two array’s withn the two array I have two array items. I try looping Like this And I dont get any output

```
{% for parentArr in page.content %} 

 {% for nestedArr in parentArr %} 
  {{nestedArr[0]}}
 {% endfor %} 

{% endfor %} 

```

Also I am using [jekyll-datapage\_gen](https://github.com/avillafiorita/jekyll-datapage_gen) plugin to create pages based on the json data in the _\_data_ folder. I would also like to add than I can access other values like _page.title_ and _page.objectives_ etc.

---

<div class="post-metadata">

**Author:** ![mmistakes](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mmistakes/32/2169_2.png) [@mmistakes](https://talk.jekyllrb.com/u/mmistakes)\
**Post date:** [January 2, 2020, 8:47pm UTC](https://talk.jekyllrb.com/t/how-to-loop-through-a-nested-array-in-liquid-syntax/3771/2 "2020-01-02T20:47:53Z")

</div>

Check the Jekyll docs on how to access a `_data` file. The sample code you included below has you trying to loop over `page.content` which isn’t your data file.

Instead it should be `site.data.filename` with `filename` being the name of the .json file.

> **[Data Files](https://jekyllrb.com/docs/datafiles/)**
>
> In addition to the built-in variables available from Jekyll, you can specify your own custom data that can be accessed via the Liquid templating system.
