You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/10/20 07:31:43 UTC
[GitHub] [apisix] monkeyDluffy6017 commented on issue #8111: When creating consumer or route using apisix admin-api, array property in plugin is changed to object property
monkeyDluffy6017 commented on issue #8111:
URL: https://github.com/apache/apisix/issues/8111#issuecomment-1285073315
Have you learn about this command: https://github.com/openresty/lua-cjson#decode_array_with_array_mt ?
It shows the example already.
```
local cjson = require "cjson"
-- default behavior
local my_json = [[{"my_array":[]}]]
local t = cjson.decode(my_json)
cjson.encode(t) -- {"my_array":{}} back to an object
-- now, if this behavior is enabled
cjson.decode_array_with_array_mt(true)
local my_json = [[{"my_array":[]}]]
local t = cjson.decode(my_json)
cjson.encode(t) -- {"my_array":[]} properly re-encoded as an array
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org