Tom  Kuhl
Tom Kuhl2mo ago

Added Decimal Places

Why is Voiceflow adding decimal places when saving JSON data to a variable? More importantly, how do I fix it? This is product review data. There is no need for more than one decimal place.
No description
1 Reply
Tom  Kuhl
Tom KuhlOP4w ago
Solved. Anyone facing the same issue can create a second variable for the rounded value then place this JavaScript in a block to show the rounded result: // parse the incoming string (or number) into a float const raw = parseFloat(VARIABLE HERE); // round to exactly one decimal place and store as a string NEW VARIABLE HERE = raw.toFixed(1);

Did you find this page helpful?