Click here to Skip to main content
15,846,004 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a method like below

public IHttpActionResult([FormUri] string name)
{
var response =_servcie.GetDetails(name);
return Ok(response.Result);
}

The application has the JSON configuration at the config level.
could you please assist how to return xml output only for this action method only so that i can not change the configuration media formatted at global level

What I have tried:

I have tried to return Content(ok,object,"application/xml")
but not getting output as xml
Posted
Comments
charles henington 17-Sep-22 11:50am    
You could convert the JSON to XML(not sure why you would want to). JSON is preferred by some because it is faster because it was designed for data interchange and XML was designed for much more. There are many resources out there for such conversion, a quick google search will point you to some.
Member 15090354 17-Sep-22 12:31pm    
Hi actually old application depend only on xml only

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900