This is response output from a request in jmeter,
{
"item": [
{
"id": 4,
"name": "American Samoa",
"capital": "Pago Pago",
"region": "Oceania",
"subregion": "Polynesia",
"population": 57100,
"area": 199,
"numericCode": "016"
},
{
"id": 249,
"name": "Zimbabwe",
"capital": "Harare",
"region": "Africa",
"subregion": "Eastern Africa",
"population": 14240168,
"area": 390757,
"numericCode": "716"
},
{
"id": 250,
"name": "Aland Islands",
"capital": "Mariehamn",
"region": "Europe",
"subregion": "Northern Europe",
"population": 28875,
"area": 1580,
"numericCode": "248"
},
{
"id": 256,
"name": "Test Name",
"capital": "Capital",
"region": "NF",
"subregion": "LoadTesting",
"population": 10,
"area": 10,
"numericCode": "9"
},
{
"id": 257,
"name": "Test Name",
"capital": "Capital",
"region": "NF",
"subregion": "LoadTesting",
"population": 10,
"area": 10,
"numericCode": "9"
},
{
"id": 258,
"name": "Test Name",
"capital": "Capital",
"region": "NF",
"subregion": "LoadTesting",
"population": 10,
"area": 10,
"numericCode": "9"
},
{
"id": 259,
"name": "Test Name",
"capital": "Capital",
"region": "NF",
"subregion": "LoadTesting",
"population": 10,
"area": 10,
"numericCode": "9"
},
{
"id": 260,
"name": "Test Name",
"capital": "Capital",
"region": "NF",
"subregion": "LoadTesting",
"population": 10,
"area": 10,
"numericCode": "9"
}
],
"statusCode": 200
}
The output is in the JSON format, and I want to retrieve all the id which have "name": "Test Name","capital": "Capital","region": "NF","subregion": "LoadTesting" and store them in an array.
I am using jmeter 5.2, with JSR223 post-processor with javascript. I am getting error with the following script.
var responseData = prev.getResponseDataAsString();
var countryDetails = responseData.Items;
log.info(prev.getResponseDataAsString());
log.info(countryDetails);


