Hi,
Total noob question here:
How do i get all the “id” values to into “userid”-variable as an array with a test script? Like 1,11,111,1111,11111 etc. At the moment my parser gets all the data within “records” array in the JSON and puts it in the “userid”-variable.
Is have a JSON body such as this:
{
"records": [
{
"id": "1",
"email": "[email protected]"
},
{
"id": "11",
"email": "[email protected]"
},
{
"id": "111",
"email": "[email protected]"
},
{
"id": "1111",
"email": "[email protected]"
},
{
"id": "11111",
"email": "[email protected]"
},
{
"id": "111111",
"email": "[email protected]"
},
{
"id": "1111111",
"email": "[email protected]"
}
]
}
My parser looks like this:
var data = JSON.parse(responseBody);
postman.setEnvironmentVariable(“userid”, JSON.stringify(data.records));
console.log(data.records);
Thank you very much already for your answers!