Hello,
I have faced similar issue where the dataset is being serialized into JSON
string and sent as response and at client side it was received in the similar format as in the query. So, I have directly sent the dataset in the response and worked.
Below is what I did.
Set the API ActionMethod return type to
IHttpActionResult
Instead of returning some string, use below
return Ok(YourDataSet);
Most Importantly, set below line in the WebApiConfig.cs file within Register method under App_Start folder...
GlobalConfiguration.Configuration.Formatters.JsonFormatter.MediaTypeMappings.Add(new System.Net.Http.Formatting.RequestHeaderMapping("Accept", "text/html", StringComparison.InvariantCultureIgnoreCase, true, "application/json"));
(Above line in config file is used to format the output in JSON result format).
Hope this solution helps to you or someone who faces similar problem.
Kindly correct me in case this is wrong or should not use.
Thank you.