# How to get on the number of items in the following response:

**URL:** <https://community.postman.com/t/how-to-get-on-the-number-of-items-in-the-following-response/41498>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [November 27, 2022, 10:54am UTC](https://community.postman.com/t/how-to-get-on-the-number-of-items-in-the-following-response/41498 "2022-11-27T10:54:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kyortush\_13](https://avatars.discourse-cdn.com/v4/letter/k/5fc32e/32.png) [@Kyortush\_13](https://community.postman.com/u/Kyortush_13)\
**Post date:** [November 27, 2022, 10:54am UTC](https://community.postman.com/t/how-to-get-on-the-number-of-items-in-the-following-response/41498/1 "2022-11-27T10:54:02Z")

</div>

{  
“Status”: 0,  
“Message”: “Successfully received 47 items for Folder (Account\_075), File (File\_109) and IsBoolean (False) as expected”,  
“Code”: 0

}

I need to get the value = 4 and set it as a test variable for the following row in my test:

pm.response.to.have.jsonBody(“Message”, “Successfully received… as expected”)

Thanks!!!

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [November 28, 2022, 4:26pm UTC](https://community.postman.com/t/how-to-get-on-the-number-of-items-in-the-following-response/41498/2 "2022-11-28T16:26:22Z")

</div>

Postman uses JavaScript under the hood.

It appears that Message will be a string, therefore I recommend looking up string manipulation, as you’re going to have to slice and dice the string.

[JavaScript String Methods (w3schools.com)](https://www.w3schools.com/js/js_string_methods.asp)

If the response is always xx items, then you may be able to assert on Includes(“47 items”) if that is acceptabe. Set the message (actual result) as its own variable.

```auto
var message = pm.response.json().Message;

pm.test("47 items", () => {
    pm.expect(message).to.include("47 items");
});

```
