I store json in Redis, and process it with help lua scripts. I detect, that redis returns big numbers in Scientific notation, if I process json with cjson.decode.
Let's consider the following 1.lua script:
local b = cjson.decode('{"v": 15947634569000323}');
return cjson.encode(b);
Try to execute it:
root@4e112ee51633:/data# redis-cli --eval 1.lua
"{\"v\":1.5947634569e+16}"
So, we receive 1.5947634569e+16 instead of 15947634569000323. I bet. not every programming language can seamlessly process both number representation. It is important, for small numbers, Redis returns number in Decimal notation:
1.lua:
local b = cjson.decode('{"v": 1594763}');
return cjson.encode(b);
root@4e112ee51633:/data# redis-cli --eval 1.lua
"{\"v\":1594763}"
It would be nice to get number always in Decimal notation.
Comment From: itamarhaber
This seems to be related: https://github.com/mpx/lua-cjson/issues/37