---
title: "Looping through array data"
description: "Repeat array data in templates to display items on separate lines, inline, or as numbered and bullet lists that match your data."
canonical_url: "https://resources.docmosis.com/template-tutorials/repeating-sections"
last_reviewed: 2026-06-12
---
# Looping through array data
Repeating data, from an array of data, can be displayed in many ways.
This example contains: each item on a new line, each item on the same line, bullet lists, and numbered lists.
## Defining a repeating section
A repeating section starts with <<rs_ and finishes with <<es_ (end section).
This example uses a list of people: <<rs_people>>...<<es_people>>
In your data you would have an array of objects like this (JSON example):
"people":[{"name":"John"}, ... ] (JSON example).
So, <<rs_people>><<name>><<es_people>>, is like saying:
FOR ***all people*** LOOP
***replace each <<name>> with data up to <<es_people>>***
If <<rs_ or <<es_ appear on a line by themselves, then that line does not appear in the final document.
### Displaying items over one or many lines
The first repeating section in the template lists one item per line, because in the template <<name>> appears on a line by itself.
The second example in the template shows how to list all of the names in a single line. To achieve this, the opening <<rs_ directive, the <<name>> field and the closing <<es_ directive are all on the same line. The field <<name>> is followed by a space, to provide a space between each name in the list.
### Numbered lists and bullet lists
The template also contains two lists.
The first is a numbered list, where the line containing <<name>> is formatted as a numbered list item.
The second is a bullet list, where the line containing <<name>> is formatted as a bullet point.
Each list grows to match the items in the data.
## Looping through array data - related json data
```json
{
"people": [
{
"name": "John"
},
{
"name": "Susan"
},
{
"name": "Marcus"
},
{
"name": "Paul"
},
{
"name": "Huan"
}
]
}
```
## Looping through array data - example template syntax
# Repeating Sections
<<rs_ starts a repeating section
<<es_ ends a section
<<rs_people>>
<<name>>
<<es_people>>
<<rs_people>><<name>> <<es_people>>
<<rs_people>>
1. <<name>>
<<es_people>>
<<rs_people>>
- <<name>>
<<es_people>>