Reputation: 961
I have a JSON response like this
Members":
[
{
"id":"ABC",
"name":"XXXX",
"XXX":"XXX",
"XXXX":"XXXX",
"Managers":
[
{
"id":XYZ,
"name":"XXX",
"XXXX":XXXX,
}
],
I need to get the value ABC and XYZ from the above response and I am using 2 JSON extractor to fetch the value and storing it in different variable.
JSON Extractor 1 expression:-
$..Members.[*].id
JSON Extractor 2 expression:-
$.Members..Managers.[*].id
But the above code picks the value from different arrays like sometime it picks the Members id as ABC but picks the Managers ID from different array. I want it to pick the value from same array value.
Any suggestions?
Upvotes: 0
Views: 1550
Reputation: 168157
Assuming that you need to extract first member and his first manager:
Add JSON Extractor as a child of the request which returns above JSON and configure it as follows:
Refer ABC
as ${memberId}
and XYZ
as ${ManagerId}
where required. You can see JMeter Variables using Debug Sampler and View Results Tree Listener combination
Upvotes: 1