# Asserting the response is false

**URL:** <https://community.postman.com/t/asserting-the-response-is-false/28224>\
**Category:** Help Hub\
**Created:** [September 28, 2021, 9:29pm UTC](https://community.postman.com/t/asserting-the-response-is-false/28224 "2021-09-28T21:29:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hannahbroch](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@hannahbroch](https://community.postman.com/u/hannahbroch)\
**Post date:** [September 28, 2021, 9:29pm UTC](https://community.postman.com/t/asserting-the-response-is-false/28224/1 "2021-09-28T21:29:57Z")

</div>

I have a request where the body of the response contains only a boolean.  
How do i create an assertion that it is false?

I tried pm.test(“Response should be false”,function(){  
pm.response.to.eql(‘false’)  
})

Im getting the error AssertionError: expected { Object (id, \_details, …) } to deeply equal ‘false’

---

<div class="post-metadata">

**Author:** ![praveendvd](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/praveendvd/32/6796_2.png) [@praveendvd](https://community.postman.com/u/praveendvd)\
**Post date:** [September 28, 2021, 10:45pm UTC](https://community.postman.com/t/asserting-the-response-is-false/28224/2 "2021-09-28T22:45:16Z")

</div>

Hi 👀 false is a bool , so needs to be compared with one too . You can use any of the below codes 😁

```auto

pm.response.to.eql(false)

or 

pm.expect(true).to.be.false

```

---

<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:** [September 29, 2021, 2:45pm UTC](https://community.postman.com/t/asserting-the-response-is-false/28224/3 "2021-09-29T14:45:39Z")

</div>

Hi @hannahbroch

It really makes a difference if your response is JSON or simply text.

If you are getting something like:

```auto
{
    "created": false
}

```

you should parse it with `pm.response.json()` first.

If this is not JSON, try something like:

```auto
pm.test("Should contain false", () => {
    pm.expect(pm.response.text()).eql('false');
    pm.expect(pm.response.text()).to.contain('false');
});

```

---

<div class="post-metadata">

**Author:** ![hannahbroch](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@hannahbroch](https://community.postman.com/u/hannahbroch)\
**Post date:** [September 29, 2021, 5:36pm UTC](https://community.postman.com/t/asserting-the-response-is-false/28224/4 "2021-09-29T17:36:58Z")

</div>

thanks! this worked great
