Quantcast
Channel: Developer Publish
Viewing all articles
Browse latest Browse all 36

How to return JSON instead of XML in ASP.NET Web API when using Chrome ?

0
0
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") );

Viewing all articles
Browse latest Browse all 36

Latest Images

Trending Articles





Latest Images