# What is wrong with pm.expect

**URL:** <https://community.postman.com/t/what-is-wrong-with-pm-expect/29334>\
**Category:** Help Hub\
**Created:** [November 2, 2021, 5:25pm UTC](https://community.postman.com/t/what-is-wrong-with-pm-expect/29334 "2021-11-02T17:25:20Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![bbahadur](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@bbahadur](https://community.postman.com/u/bbahadur)\
**Post date:** [November 3, 2021, 3:25pm UTC](https://community.postman.com/t/what-is-wrong-with-pm-expect/29334/6 "2021-11-03T15:25:40Z")

</div>

Hey @hasmukhpatel !

If you want to check if ‘data’ has all properties, you can iterate through each and perform assertion. Here is one way to achieve it:

```auto
let jsonData = pm.response.json();

console.log(jsonData.data);

pm.test("All keys present",()=>{
_.each(jsonData.data, (item)=>{
    
    pm.expect(item.hasOwnProperty('start_date')).to.be.true;
    pm.expect(item.hasOwnProperty('score')).to.be.true;
    pm.expect(item.hasOwnProperty('unit')).to.be.true;
    pm.expect(item.hasOwnProperty('status')).to.be.true;
})

})

```

Similarly you can even add assertions to check for presence of value.

Hope it helps,  
Good luck!

---

_[View the full topic](https://community.postman.com/t/what-is-wrong-with-pm-expect/29334)._
