Hey @Xinfinity,
You can simply run the following in your test script to filter out all the objects from the array with region as null:
// Replace the responseArray with your response array that you want to filter
let filteredArray = responseArray.filter((r) => r.region === null);
console.log(filteredArray); // This contains the filtered array
Now incase you want the assetId’s then you can do the following
// This will print the ids to the console
filteredArray.map((r) => console.log(r.assetId));
// Incase you want to store those id's in a separate array you
// can do the following
let assetIdsWithRegionNull = filteredArray.map((r) => r.assetId);
console.log(assetIdsWithRegionNull);
Just in case you’re interested in a one liner then here you go:
Using pre-built in lodash
let assetIds = _.chain(responseArray).filter({ region: null }).map((r) => r.assetId).value();