json icon indicating copy to clipboard operation
json copied to clipboard

Conver integer value exceeding the maximum numeric value in JavaScript to string

Open iRonin opened this issue 9 years ago • 2 comments

We have an issue with integer values served by our Rails API and consumed by EmberJS app. They are stored in the DB as bigint and they exceed the maximum numeric value in JavaScript. Isn't it something that should be handled by this gem?

iRonin avatar Jul 14 '15 13:07 iRonin

I don't think the concept of a maximum numeric value exists in JSON itself. It would be possible to check against some settable limit in the gem, but then do what? Shouldn't javascript promote too large integers to floats anyway?

flori avatar Jul 14 '15 14:07 flori

I have exact same problem. I've tried to solve it by overriding Bignum#to_json method with no luck #254 . The idea was to convert large integers (53+ bits) to string.

sproot avatar Aug 12 '15 13:08 sproot