Skip to content Skip to sidebar Skip to footer

Postman Testing - Json - Iterate Over Response With Duplicate Keys With Different Values

I'm new to the postman testing and i have found this case. I have this response { 'company': [ { 'publicKey': '40', 'mutkey': '13273811',

Solution 1:

With this you can get each functionName:

const resBody = pm.response.json();

let employees = resBody.company[0].employee

let numberOfEmployees = employees.length

for (var i = 0; i < numberOfEmployees; i++){
    let functionName = employees[i].contract[0].functionName;
    console.log(functionName);
    // your code here
}

Post a Comment for "Postman Testing - Json - Iterate Over Response With Duplicate Keys With Different Values"