1
{
    "success": {
        "text": "successfully! deleted Records"
    }
}

Want to validate text value is "successfully! deleted Records"

I tried with this

pm.test("Your test name", function () {
    var jsonData = pm.response.json();

    pm.expect(jsonData[0].text).to.eql("successfully! deleted Records");
});
Divyang Desai
  • 7,483
  • 13
  • 50
  • 76
Abhram
  • 49
  • 1
  • 1
  • 6

1 Answers1

1

You're trying to retrieve data from a JSON object, not from an array. Hence, it should be as follows.

pm.test("Your test name", function () {
    var jsonData = pm.response.json();    
    pm.expect(jsonData.success.text).to.eql("successfully! deleted Records");
});
Divyang Desai
  • 7,483
  • 13
  • 50
  • 76