Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

154
Views
Postman Validate key-value pair corresponding to another key-value pair

The Response body is like:

[
    [
        {   
          "id": "1",
          "status": false
        },
        {           
            "id": "1",
            "status": false
        }
    ],
    [
        {           
            "id": "2",
            "status": true
        }
    ]
]

I have to validate if id =1, status should be false, Test gets passed

I tried this:

var jsonData = pm.response.json();

for(var i=0; i<jsonData.length; i++)
 {
   if (jsonData[i][i].Id==="1")
    {

    if (jsonData[i][i].status=== false)
      {

        pm.test("Holiday Update is Sucssesful");
        }   

​ } } But this one is getting invalid token error

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Postman test script has support for chai assertions.

var jsonData = pm.response.json();

for (subArray of jsonData){
    for (subSubArray of subArray){
        if (subSubArray.id == 1){
            pm.test("id with 1 has status false", ()=>{
                pm.expect(subSubArray.status).to.eql(false)
            })
        }
    }

}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!