# How to check if an object does not exist in Response?

**URL:** <https://community.postman.com/t/how-to-check-if-an-object-does-not-exist-in-response/25214>\
**Category:** Help Hub\
**Created:** [June 25, 2021, 4:26pm UTC](https://community.postman.com/t/how-to-check-if-an-object-does-not-exist-in-response/25214 "2021-06-25T16:26:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![amitesh1505](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@amitesh1505](https://community.postman.com/u/amitesh1505)\
**Post date:** [June 25, 2021, 4:26pm UTC](https://community.postman.com/t/how-to-check-if-an-object-does-not-exist-in-response/25214/1 "2021-06-25T16:26:44Z")

</div>

I want to verify that a particular error message is not displayed. I am trying assert that that property should not exist. But the test is passing in both the Condition.

Here is what I am doing:

```auto
var response = pm.response.json();
var property = (response.validationResponse.validationResponsesMap["individual.isUSPerson"]);

pm.test("Verify error message is not displayed for isUS person Null", function () {
     pm.expect(response).not.have.property('property');
});

```

This test is getting Passed if property exist and if it does not exist.

Can someone please suggest?

---

<div class="post-metadata">

**Author:** ![praveendvd](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/praveendvd/32/6796_2.png) [@praveendvd](https://community.postman.com/u/praveendvd)\
**Post date:** [June 26, 2021, 7:51am UTC](https://community.postman.com/t/how-to-check-if-an-object-does-not-exist-in-response/25214/2 "2021-06-26T07:51:42Z")

</div>

Welcome to the community 😌Could you add an example, what value will property variable has

---

<div class="post-metadata">

**Author:** ![khan\_aktas](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/khan_aktas/32/8816_2.png) [@khan\_aktas](https://community.postman.com/u/khan_aktas)\
**Post date:** [June 26, 2021, 11:13pm UTC](https://community.postman.com/t/how-to-check-if-an-object-does-not-exist-in-response/25214/3 "2021-06-26T23:13:12Z")

</div>

Hello there  
You can use something like that, but as @praveendvd said, can you provide us an example

```auto
pm.test("UB", function(){
    
    pm.expect(pm.response.text()).to.include(pm.variables.replaceIn('{{Pnamestamp}}'));
    
});

```

---

<div class="post-metadata">

**Author:** ![amitesh1505](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@amitesh1505](https://community.postman.com/u/amitesh1505)\
**Post date:** [June 28, 2021, 2:53pm UTC](https://community.postman.com/t/how-to-check-if-an-object-does-not-exist-in-response/25214/4 "2021-06-28T14:53:27Z")

</div>

Here is the part of Response:  
“validationResponsesMap”: {

```
        "individual.isUSPerson": [

            {

                "errorMessage": "Missing value for required field: individual.isUSPerson",

                "ruleType": "REQUIRED",

                "fieldValue": "",

                "sequence": 0,

                "id": "",

                "shortCode": ""

            }

        ]

    },

```

In one scenario, I need to check that object “(response.validationResponse.validationResponsesMap[“individual.isUSPerson”])” does not exist.

---

<div class="post-metadata">

**Author:** ![praveendvd](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/praveendvd/32/6796_2.png) [@praveendvd](https://community.postman.com/u/praveendvd)\
**Post date:** [June 28, 2021, 3:49pm UTC](https://community.postman.com/t/how-to-check-if-an-object-does-not-exist-in-response/25214/5 "2021-06-28T15:49:28Z")

</div>

```auto
let b =

{

    "validationResponsesMap": {

        "individual.isUSPerson": [

            {

                "errorMessage": "Missing value for required field: individual.isUSPerson",

                "ruleType": "REQUIRED",

                "fieldValue": "",

                "sequence": 0,

                "id": "",

                "shortCode": ""

            }

        ]

    }

}

pm.expect(b.validationResponsesMap).to.not.have.property("individual.isUSPerson");

```

---

<div class="post-metadata">

**Author:** ![praveendvd](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/praveendvd/32/6796_2.png) [@praveendvd](https://community.postman.com/u/praveendvd)\
**Post date:** [June 28, 2021, 7:12pm UTC](https://community.postman.com/t/how-to-check-if-an-object-does-not-exist-in-response/25214/6 "2021-06-28T19:12:57Z")

</div>

Postman issues chai expect , so what ever chai expect api supports , postman supports the same
