Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pulling multiple values from JSON response using 'Json Path Extractor ' in Jmeter

{
    "response_time": 0.014376163482666016,
    "applications": [
        {
            "api_key": "blted0e7982e1cf62a8",
            "name": "gta",
            "uid": "gta",
            "account_name": "jack"
        },
        {
            "api_key": "blt1423c40d23e4a423",
            "name": "cellapp",
            "uid": "cellapp",
            "account_name": "max"
        }
    ]
}

Please help me to extract the account_name = max using Jmeter Json Path Extractor.

like image 532
swapnil shirke Avatar asked Mar 23 '23 23:03

swapnil shirke


1 Answers

$.applications.name[2] must return exactly the second name element.

If you use JSONPath like $..name this will look for all elements named name and the plugin will return a single string value which will look like ["gta","cellapp"]. You can parse this string if necessary.

Check the this site on how to build JSONPath expressions: http://goessner.net/articles/JsonPath/index.html#e2.

like image 153
Nikolay Avatar answered Apr 06 '23 03:04

Nikolay