Hello all,
I’m trying to extract a single property filed from each object of array and pass on to another GET request.
Below is the response and from the response, I need to extract all the "name"
field and iterate them to another request like below
GET https://BASE_URL/api/v1/{{name}}
[
{
"name": "User1",
"realm": "ldap"
},
{
"name": "User2",
"realm": "ldap"
},
{
"name": "User3",
"realm": "ldap"
}
]
I have tried the below one:
var data = JSON.parse(responseBody);
postman.setEnvironmentVariable("User", data[0].name);
This is storing all the user name like ["User1", "User2", "User3"]
But I’m not sure how to iterate them. Please help me on this. Thanks in advance.