How to get boolean outputs and use them in JSON payload

SUKRIT CHUGH1
Kilo Contributor

-Using IntegrationHub and Flow designer.

 

Hi,

I have to get a value "true" as boolean output from the script step and pass it as a boolean in the JSON payload builder step.

I am facing the below issues.

1) How to get an output as Boolean from script step.

2) Anything that I pass without quotes, gets passed in quotes in the JSON payload step. 

Any suggestions would be appreciated.

1 REPLY 1

Andrew Albury-D
Mega Guru

Hi Sukrit,

I tested this and it seems you are right, if you pass a True/False data-dot into the payload builder, it creates it as a string. That's not great 😞 

 

I have a few other options, as below:

find_real_file.png

 

Your best bet is to create the payload you want as a new JS object in a script step, then set a string output with JSON.stringify(obj) - this will not only fix the issue, but let you add child objects to your payload!

 

Here's the output of the string:

find_real_file.png

 

That seems more like what you are after!

 

Thanks,

Andrew