Web API Return Pure Json Data

Web API Return Pure JSON Data

When working with Web API, it is important to return data in the response in form of JSON Data so that a Client consuming the data won't do much to clean the data. You could append or define a format of data expected to be returned in the Http Header when making a request, however, in this case, we want to return pure JSON and make it a Web API standard.

Solution:

Just add the code below in the WebApiConfig.cs file and problem solved:
//Remove xml formatter
            config.Formatters.Remove(config.Formatters.XmlFormatter);