> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt.

# Iterate through a list using a For loop

A common Flows design pattern involves getting a response from a request that returns a list, then processing each item in the list. You can do this by constructing a loop with a **For** block. A **For** block requires an array as its input. Blocks such as **List**, **Get Variable**, **Evaluate**, and **Select** can return an array, but the response from an **HTTP Request** block typically doesn't. You can use TypeScript in an **Evaluate** block to transform a response into an array.

## Recipe

The following recipe shows how to use an **Evaluate** block to manipulate the response from an **HTTP Request** to create an array:

1. Create a flow and add an **HTTP Request** block.

2. In the **HTTP Request** block, create a GET request with the following URL:

   ```html
   https://openlibrary.org/subjects/love.json?limit=5
   ```

   This gets a list of five book titles, along with other response data.

3. Connect an **Evaluate** block to the **HTTP Request** block's **Success** port. Rename the `value1` input `items`, then click its **Enter path...** field and add an inline **Select** block. Set the **Select** block's path to `body.works`.

4. To make an array from the selected part of the previous block's response, enter this code in the **Evaluate** block:

   ```js
   items.map((work: any) => work.title)
   ```

   This creates an array of the book titles.

5. Connect a **For** block's **List** port to the **Evaluate** block's **Result** port.

6. Connect an **Evaluate** block to the **For** block's **Item** port and rename the `value1` input `item`. Then enter this code:

   ```js
   item.toUpperCase()
   ```

   This capitalizes all the letters in the titles.

7. Connect a **Collect** block to the **Evaluate** block's **Result** port. This will put the capitalized items back into a list.

## Try it out

To see this recipe's completed flow, check out [Cookbook: Iterate through a list using a For loop](https://www.postman.com/postman/flows-snippets/flow/68befb71cd9ea4001376c506/). You can also [clone this flow](/flows/build-flows/create/clone-flows/) to your workspace to experiment with it.

## Related pages

This recipe shows one example of how to make a loop in Flows. For more examples, see the following:

* [Loops overview](/flows/build-flows/structure/loops/overview/)
* [Break out of a loop in Flows](/flows/build-flows/structure/loops/loops-pagination/)
* [Loops with external data](/flows/build-flows/structure/loops/loops-external-data/)