cloudflare / lua-resty-json

json lib for lua and C
BSD 2-Clause "Simplified" License
167 stars 33 forks source link

how to encode #9

Closed onlynishant closed 6 years ago

onlynishant commented 6 years ago

I have gone through examples but couldn't find any API/function for JSON encoding. Please guide me.

I tried instance:get_strings(body) but got error:

lua-resty-json/json_decoder.lua:326: bad argument #2 to 'jp_parse' (cannot convert 'table' to 'const char *')

jdesgats commented 6 years ago

There is no encoding API, this library is focused on JSON parsing only at the moment.

jdesgats commented 6 years ago

If you want a general purpose JSON library, I suggest https://github.com/openresty/lua-cjson that is already bundled with OpenResty.