Express middleware for filtering the JSON responses