I’m trying to randomize a
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:
var arrayCert = [true, false]; pm.globals.set('certVal', arrayCert[Math.floor(Math.random()*arrayCert.length)]);
Which does get me a random value in
certVal . But when I try to pass that variable in my Body like so:
I get this message:
"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:
Then the post works as expected. Is there anyway I can pass a random boolean in this way?
Thanks so much for any help.