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);
Was this page helpful?
Yes Yes! this solution to the problem was helpful. No No! this solution to the problem was not helpful.. Leave ErnesTech Feedback.Feedback

Other users would like to know if this solution helped you.

Your Session is Ending
Login to Continue


© 2021 - ErnesTech - Privacy