My response code is as follows:
[
{
"id": 364,
"siteName": "FX21 - PortA",
},
{
"id": 364,
"siteName": "FX21 - PortB",
},
{
"id": 370,
"siteName": "FX05 - ER",
},
In postman I am wanting to populate an array variable with all siteName values only where id = 364. So my expected array is to look like [FX21 - PortA, FX21 - PortB]
I've tried the following but this only returns the first siteName value:
var requiredId = pm.response.json().find(function(element){
if (element.id == "364"){
return element;
}
});