Answer the question
In order to leave comments, you need to log in
How to return a DataTable in json and xml format in response to a Get request?
I receive the table from a DB.
How to format it as a response in the form of json and xml?
Will these lines be enough if the $format variable is specified in the GET request?:
GlobalConfiguration.Configuration.Formatters.JsonFormatter.AddQueryStringMapping("$format", "json", "application/json");
GlobalConfiguration.Configuration.Formatters.XmlFormatter.AddQueryStringMapping("$format", "xml", "application/xml");
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question