"Create JSON" module rounds numbers without being asked

I am having a problem with the “Create JSON” module, namely that it rounds numbers without being asked. It looks like it only does this inside the array aggregation function, because I tested the module in a seperate scenario on its own and the it does not round the numbers.

This is the input for the “Create JSON” module:

And this is when I run the module:

You can see that it converts the numbers like:

410178710761637408 → 410178710761637400
410178709276853742 → 410178709276853760

This is the data structure that is used:

According to “Number” data type in the documentation,

For some numerical items, Make may validate the input for a specified range (the minimum or maximum allowed value).

My guess is that your number is too large.

The value of the Number.MAX_SAFE_INTEGER constant is 9007199254740991 –

That is approximately 16 digits, while your number is 18 digits, hence the truncation.

The correct workaround is to store the number as a string.

2 Likes

But I have tested it with a separate “create json” module and then it works ok. Also I have set the type of both fields to text in the data structure, but still get the weird rounding…

1 Like