var data = [ // the array to be filtered ]; var filteredArray = data.filter(item => (item.name === req.query.q));