-
Notifications
You must be signed in to change notification settings - Fork 119
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
cjson.encode() modified order #66
Comments
Hi, same problem here, any lead ? Thanks. |
I hava the same problem,anybody knows why? |
|
There is a PR on the original mpx/lua-cjson repo here, that adds support for this. It only took a few small tweaks to get working with the latest openresty/lua-cjson. I have a working branch of this here. Just configure OpenResty with the |
This is a good method, but it seems that it can only be applied to a small amount of data. The number of citations Lua stack is limited to 20 |
https://plain.blog.csdn.net/article/details/120364853 |
You can possibly define the order you want in __order metatable and use the forked version: https://github.com/edo888/lua-cjson
Output:
|
when i use cjson.encode(table), the table is modified order ,why?
e.g:
local json = cjson.encode({name="yhc",age=40,birthday="1985"})
print(json) -- {"birthday":"1985","name":"yhc","age":40}
i don't want to change,how to do?
The text was updated successfully, but these errors were encountered: