You need to place this code in the WebApiConfig class, Register method.

The problem with this approach is, even though you are clearing all the formatters, the content negotiation process is still happening, which is a tiny overhead. You can avoid this by implementing your own ContentNegotiator by implementing IContentNegotiator interface.