When using the ASP.NET Web API in Google Chrome , there are times when you see the XML output instead of JSON. You might want to request JSON data so that you can view it in the browser.
How to return JSON instead of XML in ASP.NET Web API when using Chrome ?
To get it to work , simply add the below code in the WebApiConfig.cs class in the App_Start folder of your ASP.NET WebAPI project.
config.Formatters.JsonFormatter.SupportedMediaTypes . Add(new MediaTypeHeaderValue("text/html") );
Enter your email address to subscribe to this blog and receive notifications of new posts by email.