# To assert that the array in the response body contains a string value

**URL:** <https://community.postman.com/t/to-assert-that-the-array-in-the-response-body-contains-a-string-value/16942>\
**Category:** Help Hub\
**Tags:** scripts\
**Created:** [October 20, 2020, 7:41pm UTC](https://community.postman.com/t/to-assert-that-the-array-in-the-response-body-contains-a-string-value/16942 "2020-10-20T19:41:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![manami12](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@manami12](https://community.postman.com/u/manami12)\
**Post date:** [October 20, 2020, 7:41pm UTC](https://community.postman.com/t/to-assert-that-the-array-in-the-response-body-contains-a-string-value/16942/1 "2020-10-20T19:41:46Z")

</div>

Hello  
I am trying to put an assertion for a specific field value in the array , e.g. “message” should contain the value as “Invalid property value” in the below response

```auto
"errors": [
        {
            "error": 900,
            "message": "Invalid property value",
            
        } ]}

```

postman assertion script is :

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

pm.test('The `errors` contains message', () => {
    _.each(jsonData.Fee, (item) => {
        pm.expect(item.message).to.include("Invalid property value")
    })
})

```

but what I observed is this script is passed for following response also

```auto
"message": "Successful",
    "decision": "PERMIT",

```

---

<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 29, 2025, 9:41am UTC](https://community.postman.com/t/to-assert-that-the-array-in-the-response-body-contains-a-string-value/16942/2 "2025-04-29T09:41:11Z")

</div>

Closed on April 29, 2025, 9:41am UTC


