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:
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:
"Certified": "{{certVal}}",
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:
"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