AnsweredAssumed Answered

JSONSetElement bug with more than 18 digits numbers?

Question asked by AndresLP on Nov 29, 2018
Latest reply on Nov 29, 2018 by Brian Hamm

Not sure if this has been reported, or if I am missing something really obvious, or if I am going crazy!

 

This calculation:

JSONSetElement (  "" ; "number" ; 1111111111111111111  ; JSONNumber )

 

Shows this wrong result:

{"number":1.11111111111111e+18}

 

Also, this calculation:

JSONSetElement (  "" ; "number" ; 1111111111111111111  ; JSONNumber ) +1

 

Shows this wrong result:

2,1111111111111118

(probably 2.1111111111111118 for USA)

 

However, when using "JSONString", the error doesn't happen.

 

This calculation:

JSONSetElement (  "" ; "number" ; 1111111111111111111  ; JSONstring )

 

Shows the correct result (as a string):

{"number":"1111111111111111111"}

 

Also, this calculation:

JSONSetElement (  "" ; "number" ; 1111111111111111111  ; JSONstring ) +1

 

Shows the correct result (as number):

1111111111111111112

 

I noticed this when passing a parameter as JSON, where one of the parameters is a primary key defined with the new FM17 get(UUIDNumber) function. Therefore, when using get(UUIDNumber)  within JSONSetElement as JSONNumber, the JSON element value will be incorrect.

Outcomes