We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Flow designer action step Build JSON turns integer into a string

Michael Culhan1
Mega Sage

I want to send an integer in JSON but payload builder turns it into a string.  In the action input it is specified as an integer.

 

find_real_file.png

1 ACCEPTED SOLUTION

Hi @Michael C 

unfortunately you have to take the Payload Builder as it is and in most of the cases it doesn't matter as JavaScript is not a type-safe language like Java or C++. That means under the hood, the data in variables is permanently converted to other data types.

But I would like to know what concerns do you have with it? Does the consumer have any issues with the stringified version of the number?

Kind regards
Maik

View solution in original post

7 REPLIES 7

Glad to help you!

I don't know if this is something new since this post or not, but JSON Builder now lets you specify a Type of Number.

Kevin Clark1
Tera Contributor

Came here to say it looks like JSON Builder step can handle Integers being passed and tagged as number fields successfully, but JSON Parser step doesn't let you specify a number field - everything is a string, array or object 😞

 

Also another observation - JSON Builder (and Flow Designer in general) doesn't seem to be able to allow the developer to choose whether a Choice field pill will return the Choice Label or Value.  I would LOVE to be able to do this and use JSON builder to return the choice integer value for integrations that them.

 

Another observation is that JSON Builder doesn't seem to be able to convert a Currency field to a decimal number - it leaves it as a string with a currency character (recognising how tricky currencies can be,  I'll let this one slide) 🙂 

 

My solution to all this is to pass my reference object into a Script step to do all the Choice value conversions against the sys_choice table and to also pass my currency values so they can be transformed.