json.lua
json.lua copied to clipboard
A lightweight JSON library for Lua
I installed nginx-full and trying to use json.lua with NGINX: Example: nginx.conf: `location /test { default_type 'text/plain'; content_by_lua_block { local json = require("json") ngx.say(json.decode('[1,2,3,{"x":10}]')) }` then curl http://localhost:8080/test and got...
If table contains function, this happens: " json.lua:130: unexpected type 'function' "
When used .. in loops, the lua will create a lot of garbage and thus affect performance. I changed your script (json-fix.lua) ``` c:\test>busybox diff -U 0 json.lua json-fix.lua ---...
``` ❯ lua -v Lua 5.4.2 Copyright (C) 1994-2020 Lua.org, PUC-Rio ❯ lua test.lua [pass] numbers [pass] literals [pass] strings [pass] unicode [pass] arrays [pass] objects [pass] decode invalid [pass]...
Suggestion / Request to use annotated tags for version tag numbers. This is considered "best practice" by a number of open source projects and annotated tags have a number of...
I am new to lua. A case, i was built a nginx + luajit +redis2. I was used json.lua and got follow errer message: ``` 2021/02/07 08:42:02 [error] 37#37: *11...
A web service I need to use is returning the following in its JSON: "Id":1618065507111835497 But when using this Lua library to decode it, the result is losing precision as...
By going through the table before to get the maximum index we can handle sparse arrays. Also tostring seems to work better by maintaining float and integer number conversion.
As I need to have a human-readable file, I added a function to insert newlines and tabs to an already encoded json string (what you explicitly excluded in your documentation).