XMl Response from WEB API solution

Tuesday, November 3, 2015

I have a Web API solution which is configured to respond results always in JSON format as below



config.Formatters.JsonFormatter.SerializerSettings.Formatting =
Newtonsoft.Json.Formatting.Indented;


But now I have a requirement to respond only one of the API calls with XML Response . But if I add the XML formatter to the system



config.Formatters.XmlFormatter.UseXmlSerializer = true; 


then all the API calls get affected.



I have a XML string hardcoded which I want to give as reponse .
How can I solve this problem ?

0 comments:

Post a Comment