NGINX cjson lua decode json -


i trying run cjson decode example found in manual :

and can't seem work.

here relevant config:

 location / {             content_by_lua '                     local cjson = require("cjson")                     json_text = '[ true, { "foo": "bar" } ]'                     value = cjson.decode(json_text)                     ngx.say(value)             ';              resolver 8.8.8.8;     } 

i error :

sudo nginx -t nginx: [emerg] unexpected "[" in /etc/nginx/nginx.conf:29 nginx: configuration file /etc/nginx/nginx.conf test failed 

if remove square brackets get:

sudo nginx -t nginx: [emerg] directive "content_by_lua" not terminated ";" in  /etc/nginx/nginx.conf:28 nginx: configuration file /etc/nginx/nginx.conf test failed 

does have idea doing wrong ? seems cjson should easy way parse json in nginx , know people doing ... can't figure out why example code isn't working me.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -