Parse JSON POST request into nginx variable

Robert Paprocki rpaprocki at
Sun Jun 15 01:58:12 UTC 2014

There is a form input module you can use to parse POST body into a variable:

However this will not get JSON data. For this you make want to look into
leveraging the nxin Lua module in conjunction with the Lua cjson module:

The openresty package combines the above two modules into one package :)

On 06/14/2014 06:48 PM, justink101 wrote:
> How can I read a POST request body which is JSON and get a property?  I need
> to read a property and use it as a variable in proxy_pass.
> Pseudo code:
>    $post_request_body = '{"account": "", "more-stuff":
> "here"}';
>    // I want to get
>    $account = "";
>    proxy_pass $account/rest/of/url/here;
> Posted at Nginx Forum:,250864,250864#msg-250864
> _______________________________________________
> nginx mailing list
> nginx at

More information about the nginx mailing list