Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

JSON Build/Parse, data types, trailing zeros

iwilliams
8 - Asteroid

I am having an issue where I have values with trailing zeros (ex: 100.00), when I put them in JSON format using the JSON Build tool, I specify that this column is a float, but when I parse this JSON, that column gets picked up as an int (also when I output the json, the trailing zeros are missing). I need for the column to stay as a float when I parse or output it.

 

I know that I could convert the value to a string and then place in json format, but I need it to be numeric. I attached a sample workflow of what I am talking about. Any help with this is appreciated.

 

 

3 REPLIES 3
Matt_D
9 - Comet

Hi @iwilliams Quickly googling this, this appears to be a JSON thing, not an Alteryx thing.

 

"floating point types don't have a way to preserve trailing zeros"  - To resolve in JSON you must represent the number as a string; i.e. put quotes around it.

iwilliams
8 - Asteroid

Thanks for responding @Matt_D . That's interesting, but also confusing because when I initially receive these values (response from api) they are in json format, and when I parse it, initially, I get a float in Alteryx. But when I convert back to json using the json build tool - that's when the data type gets changed and the zeros are gone. 

 

There was also another exe process that used the same data and it was able to preserve the trailing zeros in the json output

 

Not sure how the zeros are preserved in some cases, but not others 

 

Matt_D
9 - Comet

@iwilliams I'm not sure, been looking it appears to be rending code specific, as in with JSON rendering in some syntax you can specify trailing zeros (GoLang being one) but by JSON default standards it appears as though  - "floating point numbers are rendered without a decimal point and fractions if its value is an integer value. The representation is shorter, and it means the same number."

Labels