Issue with JSValue

Hello, a JSON has a 'long' type field "id":

I convert the JSON with this code:

TYDCommonResponse = record
code: NativeInt;
data: JSValue;
message: String;
status: String;
timestamp: NativeUInt;
end;
......
var
TmpResponse: TYDCommonResponse;
......
TmpResponse:=TYDCommonResponse(TJSJSON.parse(Req.responseText));

But I found the value of the field "TmpResponse.data.id" is "1466591939850948600", the last two numbers are wrong.

Anyone knows why this happens??

I suspect this is because this number exceeds the maximum JavaScript safe number:

The MAX_SAFE_INTEGER constant has a value of 9007199254740991 (9,007,199,254,740,991 or ~9 quadrillion). The reasoning behind that number is that JavaScript uses double-precision floating-point format numbers as specified in IEEE 754 and can only safely represent integers between -(2^53 - 1) and 2^53 - 1

Understand
Thanks @brunofierens

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.