# How to assert on a property

**URL:** <https://community.postman.com/t/how-to-assert-on-a-property/16876>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [October 18, 2020, 10:00pm UTC](https://community.postman.com/t/how-to-assert-on-a-property/16876 "2020-10-18T22:00:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bahri.vinayak](https://avatars.discourse-cdn.com/v4/letter/b/ea5d25/32.png) [@bahri.vinayak](https://community.postman.com/u/bahri.vinayak)\
**Post date:** [October 18, 2020, 10:00pm UTC](https://community.postman.com/t/how-to-assert-on-a-property/16876/1 "2020-10-18T22:00:38Z")

</div>

Below is the json response, I want to make sure “status” property is present. I don’t want to test for the value of the status i.e. 422

I tried with the following, but no luck.  
pm.expect(responseInJson).to.have.property(‘errors[0].extensions.data.status’);

> Blockquote

{

```
"errors": [

    {

        "message": "UnprocessableEntityError",

        "path": [

            "login"

        ],

        "extensions": {

            "code": "UNPROCESSABLE_ENTITY_ERROR",

            "name": "Unprocessable Entity",

            "data": {

                "errorCode": "",

                "status": 422,

                "friendlyMessage": "Could not register at this time. Please try again later"

            }

        }

    }

],

"data": null

```

}

Update:  
I was able to assert using the below code, but would like to know what is the difference between the 2?

//This one works  
pm.response.to.have.jsonBody(“data.loginPowerPassCard.accessToken”);

//This one doesnt  
pm.expect(responseInJson).to.have.property(“data.loginPowerPassCard.accessToken”);

---

<div class="post-metadata">

**Author:** ![vdespa](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/vdespa/32/2770_2.png) [@vdespa](https://community.postman.com/u/vdespa)\
**Post date:** [October 20, 2020, 7:22pm UTC](https://community.postman.com/t/how-to-assert-on-a-property/16876/2 "2020-10-20T19:22:25Z")

</div>

`.to.have.property('errors[0].extensions.data.status');` probably does not work because that does not count as a property. You can just paste a path to a property.

`.to.have.property('errors');` would work, since `errors` is a property of the root object.

`.to.have.jsonBody()` may work, since you can provide a parameter with a path. So this will test the existence of the path within the response body.
