-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lua 5.3 to add integer #33
Comments
i think of an clumsy solution.we can edit the file lua_cjson.c. |
The JSON numbers are floating point (a superset of integers). Any code consuming JSON needs to handle floating point numbers to avoid problems. Attempting to auto-detect between floats and integers will reduce performance and is likely to cause surprises elsewhere. |
Just tested it versus another JSON parsers. Great performance but sample result file 4% bigger due ugly ".0" after any number. Also lua 5.3 natively support int64 while I'm sure cjson returns floats. So I'll refrain from using it. Fast but not correct. |
the clone branch https://github.com/cloudwu/lua-cjson |
local cjson = require "cjson"
local tab = {}
tab[10] = 199
tab.pp = "fan"
local estr = cjson.encode(tab)
print("-------------", estr)
local totab = cjson.decode(estr)
for k,v in pairs(totab) do
print("---fff-------", k,v)
end
the question : 199 change to 199.0, so bad when i use to json protocol to communicate with client!
how to solve it, please.
thanks!
The text was updated successfully, but these errors were encountered: