lua_package_path '/etc/jsonpath/?.lua;;'; error_log /var/log/nginx_error.log info; server { listen 80; server_name localhost; location / { default_type text/html; content_by_lua ' local jsonpath = require("jsonpath") jsonpath.init("/etc/jsonpath/libjsonpath_lib.so") local data = ngx.location.capture("/example.json") local template = jsonpath.compile("$..book[?(@.price<30 && @.category==\'fiction\')]") local result = template(data.body) ngx.say(result) '; } location /example { root /etc/jsonpath/example; } }