Here is the output of my response code:
[
{
"id": 364,
"siteName": "FX21 - PortA",
},
{
"id": 364,
"siteName": "FX21 - PortB",
},
{
"id": 370,
"siteName": "FX05 - ER",
},
I'm trying to extract siteName values where id equals 364 and store them in an array variable using Postman. The expected array should be [FX21 - PortA, FX21 - PortB]
However, the code I've attempted so far only retrieves the first siteName value:
var requiredId = pm.response.json().find(function(element){
if (element.id == "364"){
return element;
}
});