# How to pass boolean values using Postman?

**URL:** <https://community.postman.com/t/how-to-pass-boolean-values-using-postman/1174>\
**Category:** Help Hub\
**Tags:** boolean\
**Created:** [March 8, 2018, 6:13am UTC](https://community.postman.com/t/how-to-pass-boolean-values-using-postman/1174 "2018-03-08T06:13:16Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![kzknls](https://avatars.discourse-cdn.com/v4/letter/k/958977/32.png) [@kzknls](https://community.postman.com/u/kzknls)\
**Post date:** [March 8, 2018, 6:13am UTC](https://community.postman.com/t/how-to-pass-boolean-values-using-postman/1174/1 "2018-03-08T06:13:16Z")

</div>

Using Postman, I passed boolean value, But I got error.  
The value which I pass to server through Postman is not a boolean value.

I just input True in value form.  
is it wrong?

How to pass boolean value?

---

<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:** [March 8, 2018, 7:27am UTC](https://community.postman.com/t/how-to-pass-boolean-values-using-postman/1174/2 "2018-03-08T07:27:21Z")

</div>

It is unclear from your question how exactly you are ending the data, but this will not matter a lot.

Regardless of the format (query params, JSON body) it is the job of the backend to parse and validate the request.

So even if you send a parameter like “active=true”, it is still a string, this is how the HTTP protocol works.

Hope this helps clarify the mystery.

---

<div class="post-metadata">

**Author:** ![akshara.kothapalli](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@akshara.kothapalli](https://community.postman.com/u/akshara.kothapalli)\
**Post date:** [March 8, 2018, 2:54pm UTC](https://community.postman.com/t/how-to-pass-boolean-values-using-postman/1174/3 "2018-03-08T14:54:33Z")

</div>

Hi Nelson

You can parse the string as boolean data type as below -

var bflag = Boolean(“true”);  
var bflag1 = Boolean(“false”);

Let me know if it works or not!

---

<div class="post-metadata">

**Author:** ![kzknls](https://avatars.discourse-cdn.com/v4/letter/k/958977/32.png) [@kzknls](https://community.postman.com/u/kzknls)\
**Post date:** [March 9, 2018, 1:11am UTC](https://community.postman.com/t/how-to-pass-boolean-values-using-postman/1174/4 "2018-03-09T01:11:10Z")

</div>

I mean using Postman how to pass boolean values. You wrote js code, right?

---

<div class="post-metadata">

**Author:** ![kzknls](https://avatars.discourse-cdn.com/v4/letter/k/958977/32.png) [@kzknls](https://community.postman.com/u/kzknls)\
**Post date:** [March 9, 2018, 1:16am UTC](https://community.postman.com/t/how-to-pass-boolean-values-using-postman/1174/5 "2018-03-09T01:16:52Z")

</div>

So, there is no way to pass boolean value to server using Postman? because through the HTTP protocol just string-formatted data passed?

Then I have to do format data on server?

---

<div class="post-metadata">

**Author:** ![ed\_truqc](https://avatars.discourse-cdn.com/v4/letter/e/ac91a4/32.png) [@ed\_truqc](https://community.postman.com/u/ed_truqc)\
**Post date:** [June 8, 2018, 10:13pm UTC](https://community.postman.com/t/how-to-pass-boolean-values-using-postman/1174/6 "2018-06-08T22:13:23Z")

</div>

Hi there,

I’m trying to randomize a `true`/`false` boolean value, which I want to assign to a variable that I can then pass to my Body and post as part of my JSON. I tried this:

```auto
var arrayCert = [true, false];
pm.globals.set('certVal', arrayCert[Math.floor(Math.random()*arrayCert.length)]);

```

Which _does_ get me a random variable in `certVal` . But when I try to pass that variable in my Body like so:

```auto
"Certified": "{{certVal}}",

```

I get this message:

```auto
"INVALID_REQUEST_PARAMETER: 'Certified' Expected type boolean but found type string; ",

```

I think the double quotes in the body is passing the variable as a string, hence the error. If I change it to:

```auto
"Certified": true,

```

Then the post works as expected. Is there anyway I can pass a random boolean in this way?

Thanks so much for any help.

Ed

---

<div class="post-metadata">

**Author:** ![kunagpal](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/kunagpal/32/9_2.png) [@kunagpal](https://community.postman.com/u/kunagpal)\
**Post date:** [July 5, 2018, 7:47pm UTC](https://community.postman.com/t/how-to-pass-boolean-values-using-postman/1174/7 "2018-07-05T19:47:36Z")

</div>

@ed_truqc Variable references of the form `{{var_name}}` are resolved literally within all parts of a request, so the following will work:

```auto
"Certified": {{certVal}},

```

As there are no enclosing quotes around `{{certVal}}`, it will be resolved to `true`/`false`, which will get your requests working regularly 😄

---

<div class="post-metadata">

**Author:** ![zrshishir](https://avatars.discourse-cdn.com/v4/letter/z/779978/32.png) [@zrshishir](https://community.postman.com/u/zrshishir)\
**Post date:** [June 28, 2022, 5:56am UTC](https://community.postman.com/t/how-to-pass-boolean-values-using-postman/1174/8 "2022-06-28T05:56:03Z")

</div>

you can use 1 instead of true and 0 instead of false. And convert it to bool values within your backend.

---

<div class="post-metadata">

**Author:** ![nicotouri](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/nicotouri/32/16022_2.png) [@nicotouri](https://community.postman.com/u/nicotouri)\
**Post date:** [June 6, 2023, 3:43pm UTC](https://community.postman.com/t/how-to-pass-boolean-values-using-postman/1174/9 "2023-06-06T15:43:19Z")

</div>

it works, thank you!

---

<div class="post-metadata">

**Author:** ![descent-module-obs19](https://avatars.discourse-cdn.com/v4/letter/d/f05b48/32.png) [@descent-module-obs19](https://community.postman.com/u/descent-module-obs19)\
**Post date:** [April 7, 2024, 6:29am UTC](https://community.postman.com/t/how-to-pass-boolean-values-using-postman/1174/11 "2024-04-07T06:29:55Z")

</div>

Sorry to say, I didn’t get it properly…

---

<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 7, 2024, 8:32am UTC](https://community.postman.com/t/how-to-pass-boolean-values-using-postman/1174/12 "2024-04-07T08:32:41Z")

</div>

Hey @descent-module-obs19 👋

Welcome to the Postman community :postman:

As you’re responding to a topic over 10 months after the last post - can I ask that you raise a new topic with all of your details so that we can help with your specific issue.

I’m going to close this topic now.

---

<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 7, 2024, 8:32am UTC](https://community.postman.com/t/how-to-pass-boolean-values-using-postman/1174/13 "2024-04-07T08:32:46Z")

</div>

Closed on April 7, 2024, 8:32am UTC


