How to extract the value of a key in json in nginx without using lua module

Viewed 24

input:

{
    "msisdn": "01925000000"
}

nginx config:

map $request_body $msisdn {
    ~\"msisdn\"\s*:\s*\"[0-9]*\"    $1;
}

location /smaple/route/ {
    return 200 $msisdn;
}

Output: Return empty response with status code 200

Expected Result: Return response body 01925000000 with status code 200

0 Answers
Related