Sanjeev
Sanjeev

Reputation: 1

How to get multiple ids from JSON and pass it to next request in jmeter

please find the attached json:

        "0":"10000267",
        "no":"10000267",
        "1":"2180100151-1-40",
        "article_no":"2180100151-1-40",
        "2":"550053",
        "agent_code":"550053",
        "3":"103896",
        "customer_code":"103896",
        "4":"A+",
        "grade":"A+",
        "5":"1336489",
        "id":"1336489",
        "6":"8907679958231",
        "ean_code":"8907679958231",
        "7":"315",
        "quantity":"315",
        "8":"27",
        "available_quantity":"27"
    },
    {
        "0":"10000286",
        "no":"10000286",
        "1":"2180100151-1-40",
        "article_no":"2180100151-1-40",
        "2":"550108",
        "agent_code":"550108",
        "3":"112230",
        "customer_code":"112230",
        "4":"A+",
        "grade":"A+",
        "5":"1432890",
        "id":"1432890",
        "6":"8907679958231",
        "ean_code":"8907679958231",
        "7":"494",
        "quantity":"494",
        "8":"27",
        "available_quantity":"27"

Now i have extracted "id" using JSON extractor and i have to pass these multiple ids in next request . How can i do this?

For Eg: I have to pass id in next request in this format id=1432890,1336489.How can i achieve this.If any one add a code that can help to achieve this it would be great.

Upvotes: 0

Views: 1414

Answers (1)

sunny_teo
sunny_teo

Reputation: 1999

Call the variable by their names in the next request like ${varJson_1},${varJson_2}. So, in the next request id=${varJson_1},${varJson_2}.

If you are using json extractor to fetch multiple values then below screenshot will help you to get all the values in one variable. Then, in the next request call that variable.

enter image description here As shown below, foo_All contains all the values fetched by the json in one variable. Use this in the next. enter image description here

Hope this helps.

Upvotes: 1

Related Questions