# How to write a statement to verify that in the list of entities there is an entity with the status "Recalled"

**URL:** <https://community.postman.com/t/how-to-write-a-statement-to-verify-that-in-the-list-of-entities-there-is-an-entity-with-the-status-recalled/12072>\
**Category:** Help Hub\
**Tags:** tests, collections\
**Created:** [April 20, 2020, 11:46am UTC](https://community.postman.com/t/how-to-write-a-statement-to-verify-that-in-the-list-of-entities-there-is-an-entity-with-the-status-recalled/12072 "2020-04-20T11:46:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![EKanischev](https://avatars.discourse-cdn.com/v4/letter/e/0ea827/32.png) [@EKanischev](https://community.postman.com/u/EKanischev)\
**Post date:** [April 20, 2020, 11:46am UTC](https://community.postman.com/t/how-to-write-a-statement-to-verify-that-in-the-list-of-entities-there-is-an-entity-with-the-status-recalled/12072/1 "2020-04-20T11:46:32Z")

</div>

Hello everybody!

Please help with writing a script for validating the response in the body of the json message (an example of json below).

So far, such a test returns an error:

```
pm.test ("Appeals with the status 'Withdrawn' come in the list v2", function () {
    var jsonData = pm.response.json ();
    pm.expect (jsonData.body.appeals.appeal) .to.have.property ("id");
})

```

I want to check that the list contains the entity with the status “Withdrawn”

Example json:

```
{
   "success":true,
   "body":{
      "lastPage":true,
      "appeals":[
         {
            "appeal":{
               "id":"1-SKZND7K",
               "num":"200416-0098-219500",
               "createDate":"2020-04-15T21:23:57.000Z",
               "clientDate":"2020-04-20T13:24:52.000Z",
               "status":"В работе",
               "subjects":[
                  "Тематика для клиента - Тест",
                  "Тематика для клиента - Тест 2"
               ]
            }
         },
         {
            "appeal":{
               "id":"1-SKYEU04",
               "num":"200416-0098-218900",
               "createDate":"2020-04-15T21:15:55.000Z",
               "clientDate":"2020-04-20T13:17:07.000Z",
               "status":"В работе",
               "subjects":[
                  "Тематика для клиента - Тест",
                  "Тематика для клиента - Тест 2"
               ]
            }
         },
         {
            "appeal":{
               "id":"1-SKYBBK0",
               "num":"200415-0098-209100",
               "createDate":"2020-04-15T20:55:45.000Z",
               "clientDate":"2020-04-20T12:57:21.000Z",
               "status":"В работе",
               "subjects":[
                  "Тематика для клиента - Тест",
                  "Тематика для клиента - Тест 2"
               ]
            }
         }
      ]
   }
}

```

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [April 20, 2020, 12:47pm UTC](https://community.postman.com/t/how-to-write-a-statement-to-verify-that-in-the-list-of-entities-there-is-an-entity-with-the-status-recalled/12072/2 "2020-04-20T12:47:00Z")

</div>

Hey @EKanischev,

I’m not 100% sure what you want to do here and the response example that you added, doesn’t include `Withdrawn` as a status.

If you wanted to check that the `status` property contains a certain state, you can use this to loop through the `appeals` array and check each of the `appeal` objects. I don’t know what the correct word for Withdrawn is so I google translated it but I think that might be wrong 😄

```
pm.test ("Appeals with the status 'Withdrawn' come in the list v2", function () {
    var jsonData = pm.response.json ();
    _.each(jsonData.body.appeals, (arrItem) => {
        pm.expect(arrItem.appeal).to.have.property("status").to.equal("отозваны");
    });
}); 

```

If you needed something more specific, please let me know 😄
