Files
nginx/auto
Roman SemenovandDmitry Volyntsev a1f4a61769 Added the json parser module
Added the http_json_module with a json_set directive that
extracts values from JSON stored in nginx variables and exposes them
as new nginx variables.  Parsed results are cached per request, so
multiple json_set directives using the same source expression trigger
only one parse.  The directive is available in the http main context.

Example usage:

    http {
        json_set $user_name $arg_data user.name;
        json_set $user_age  $arg_data user.age;
        json_set $tag0      $arg_data tags[0];

        server {
            listen 8080;

            location / {
                return 200 "name=$user_name age=$user_age "
                           "tag0=$tag0\n";
            }
        }

        # quoted keys for names containing '.', '[', ']', or that
        # are empty; the whole argument is single-quoted so that the
        # inner '"' reach the path parser intact
        json_set $host      $arg_data '["a.b.com"]';
        json_set $nested    $arg_data 'obj["a.b"].c[2]';
        json_set $quoted    $arg_data 'obj["a\\"b"]';
    }

Co-authored-by: Dmitry Volyntsev <d.volyntsev@f5.com>
2026-08-24 11:08:31 -07:00
..
2012-01-18 15:07:43 +00:00
2012-01-18 15:07:43 +00:00
2012-01-18 15:07:43 +00:00
2012-01-18 15:07:43 +00:00
2021-09-21 14:46:25 +03:00
2026-08-24 11:08:31 -07:00
2012-01-18 15:07:43 +00:00
2026-08-24 11:08:31 -07:00
2026-08-24 11:08:31 -07:00
2012-01-18 15:07:43 +00:00
2021-12-25 01:07:15 +03:00