This is the JS solution to filtering the JSON array based on network tags within Postman. I'm not clear how you want to use the data, so I am just printing it to the console. (Menu -> Developer --> Show DevTools (CurrentView) ) var jsonData = JSON.parse(responseBody);
var filteredData = jsonData.filter(function(item) {
if (!item.tags) {
return
}
return item.tags.includes("KIT");
});
console.log("filteredData", filteredData); My Local Test As a more generic HTML/JS solution var data = [{
"id": "redacted1",
"organizationId": "xxx",
"name": "Location1",
"timeZone": "Europe/Paris",
"tags": " KIT0003 OSI ",
"type": "combined",
"disableMyMerakiCom": false,
"disableRemoteStatusPage": false
},
{
"id": "redacted2",
"organizationId": "xxx",
"name": "Location2",
"timeZone": "Europe/Paris",
"tags": " KIT0006 OSI ",
"type": "combined",
"disableMyMerakiCom": false,
"disableRemoteStatusPage": false
}, {
"id": "redacted3",
"organizationId": "xxx",
"name": "Location3",
"timeZone": "Europe/Paris",
"tags": " OSI ",
"type": "combined",
"disableMyMerakiCom": false,
"disableRemoteStatusPage": false
}
]
newData = data.filter(function(item) {
if (!item.tags) {
return
}
return item.tags.includes("KIT");
});
console.log(newData);
//Print to HTML page
document.getElementById("demo").innerHTML = "<pre>"+JSON.stringify(newData,undefined, 2) +"</pre>" Results [
{
"id": "redacted1",
"organizationId": "xxx",
"name": "Location1",
"timeZone": "Europe/Paris",
"tags": " KIT0003 OSI ",
"type": "combined",
"disableMyMerakiCom": false,
"disableRemoteStatusPage": false
},
{
"id": "redacted2",
"organizationId": "xxx",
"name": "Location2",
"timeZone": "Europe/Paris",
"tags": " KIT0006 OSI ",
"type": "combined",
"disableMyMerakiCom": false,
"disableRemoteStatusPage": false
}
] Here is a working JS fiddle to demo it. https://jsfiddle.net/oa86k3ug/ Hope this helps, Cory
... View more