# What is the correct way to iterate through a json list?

**URL:** <https://community.automationedge.com/t/what-is-the-correct-way-to-iterate-through-a-json-list/1711>\
**Category:** Get Help & Discuss\
**Created:** [February 27, 2020, 4:21pm UTC](https://community.automationedge.com/t/what-is-the-correct-way-to-iterate-through-a-json-list/1711 "2020-02-27T16:21:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![israelvf](https://avatars.discourse-cdn.com/v4/letter/i/6de8d8/32.png) [@israelvf](https://community.automationedge.com/u/israelvf)\
**Post date:** [February 27, 2020, 4:21pm UTC](https://community.automationedge.com/t/what-is-the-correct-way-to-iterate-through-a-json-list/1711/1 "2020-02-27T16:21:06Z")

</div>

Hello,

I have as output from a python script a list of dictionaries formatted as json.  
In each dictionary I have personal information like name and email.  
I would like to turn each item in that list into a row, so that the email step is executed for each item separately.  
I thought of using JavaScript for that. I can display an alert for each item on this list, but how do I send each item separately to the output?  
Is there any other way to do this?

**The workflow:**  
 ![Workflow](https://canada1.discourse-cdn.com/flex027/uploads/automationedge/original/1X/c59dfa7e91e90221b9cf5d48d22d9cb43a4cd296.png)

**Python Script:**

```python
import json

dict_list = [
    {
        "name": "Jon Doe",
        "email": "jon_doe@test.com"
    },
    {
        "name": "Jane Doe",
        "email": "jane_doe@test.com"
    }
]

dict_list = json.dumps(dict_list)

```

**Java Script:**

```auto
var parsedInput = JSON.parse(dict_list);

parsedInput.forEach(function(item) {
  Alert(JSON.stringify(item));
});

```

Thanks,

Israel

---

<div class="post-metadata">

**Author:** ![sachin.deshpande](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@sachin.deshpande](https://community.automationedge.com/u/sachin.deshpande)\
**Post date:** [February 28, 2020, 10:10am UTC](https://community.automationedge.com/t/what-is-the-correct-way-to-iterate-through-a-json-list/1711/2 "2020-02-28T10:10:44Z")

</div>

Please go through the following video

It explains how to use JSON input step. Use “Source is from a previous step” and pass the JSON String. If you configure JSON input step properly, you will get “Name” and “Email” as two fields to work on.

---

<div class="post-metadata">

**Author:** ![israelvf](https://avatars.discourse-cdn.com/v4/letter/i/6de8d8/32.png) [@israelvf](https://community.automationedge.com/u/israelvf)\
**Post date:** [February 28, 2020, 2:00pm UTC](https://community.automationedge.com/t/what-is-the-correct-way-to-iterate-through-a-json-list/1711/3 "2020-02-28T14:00:55Z")

</div>

Thanks Sachin, it worked like a charm!

---

<div class="post-metadata">

**Author:** ![sudhanshu](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@sudhanshu](https://community.automationedge.com/u/sudhanshu)\
**Post date:** [January 10, 2024, 10:06am UTC](https://community.automationedge.com/t/what-is-the-correct-way-to-iterate-through-a-json-list/1711/4 "2024-01-10T10:06:43Z")

</div>

I do not see link to any video here. Think you can re-post one please.  
I have a similar requirement as OP, just that input JSON array has no fixed size and I want to calculate the size of array & then fetch the values at each indexes one by one, while iterating within a loop.

---

<div class="post-metadata">

**Author:** ![Jane](https://avatars.discourse-cdn.com/v4/letter/j/ecb155/32.png) [@Jane](https://community.automationedge.com/u/Jane)\
**Post date:** [January 11, 2024, 4:37am UTC](https://community.automationedge.com/t/what-is-the-correct-way-to-iterate-through-a-json-list/1711/5 "2024-01-11T04:37:46Z")

</div>

Hi! Sudhanshu,

Here is a video URL showcasing the Json Input step -

[![](https://img.youtube.com/vi/TY4Jrm-HBM0/hqdefault.jpg "AutomationEdge for Dummies: Json Input (With Subtitle)") ](https://www.youtube.com/watch?v=TY4Jrm-HBM0)
