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

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

Python Script:

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:

var parsedInput = JSON.parse(dict_list);

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

Thanks,

Israel

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.

2 Likes

Thanks Sachin, it worked like a charm!