json.lua icon indicating copy to clipboard operation
json.lua copied to clipboard

Large numbers serialized incorrectly

Open winseros opened this issue 3 years ago • 3 comments

I have a lua object containing a large number:

local obj = {prop=1925036013156063406}

When the object is serialized, the JSON looks like:

{"prop":1.9250360131561e+18}

and can not be parsed by other JSON libraries on other programming languages.

The correct serializaion output would be:

{"prop":1925036013156063406}

winseros avatar Nov 10 '22 06:11 winseros

@winseros try this https://github.com/aleksanderd/json.lua/commit/15823a48b31befa5f623134f6d8c57a2f5a603f9

aleksanderd avatar Nov 16 '22 15:11 aleksanderd

@aleksanderd it works fine. I'll use it for now. Thank you!

winseros avatar Nov 18 '22 06:11 winseros

Indeed it could be serialized differently, however that is valid JSON. Whatever other library you are parsing it from does not follow the spec.

vurvdev avatar Jun 29 '23 04:06 vurvdev