I am passing the exact Id (i.e. 123456789123456.99) from controller in JSONResult, but when I get the value in AJAX response I get Id (i.e. 123456789123456.98).
I have observed a weird behavior in JavaScript while parsing data. Please look into the below image. Can anyone please help me here to get the same Id after parsing through JSON.
The
Id
value is too big. JavaScript uses double-precision floats for numbers, and they have about 15 digits of precision. The highest integer that JavaScript can reliably save is something like 2^51. That is why the value get rounded when you parse.However, you can work around this limitation by sending the number as a string like so: