title: Adding the "Produces" filter globally in ASP.NET Core
body: <p>I'm developing a REST Api using ASP.NET Core. I want to force the application to produce JSON responses which I can achive decorating my controllers with the "Produces" attribute. Example:</p>
  
  <pre><code>[Produces("application/json")]
  public class ProductsController : ControllerBase
  {
      ...
  }
  </code></pre>
  
  <p>But according to this article: <a href="https://docs.microsoft.com/en-us/aspnet/core/mvc/models/formatting" rel="noreferrer">https://docs.microsoft.com/en-us/aspnet/core/mvc/models/formatting</a> the filter can be applied globally, but I can't really figure out how. </p>
  
  <p>Is there anyone out there that could provide a simple example of how to apply the "Produces" filter globally?</p>