I have a REST
service which returns a json
serialized DataTable
.
When I make a request to the service I get no data ("No data receieved" from chrome), but when I change the return type to string
and return a string which is the serialized DataTable
, everything works fine (except I have to parse the Json
string).
//Doesn't Work
[OperationContract]
[WebGet(ResponseFormat = WebMessageFormat.Json,
UriTemplate = "data")]
public DataTable LoadData2() {
return JsonQueryDatabase2(VCAPSProduction);
}
.
// Works, but returns a json string
[OperationContract]
[WebGet(ResponseFormat = WebMessageFormat.Json,
UriTemplate = "data")]
public string LoadData2() {
return JsonConvert.SerializeObject(JsonQueryDatabase2(connString));
}
How can I get my service to return a Json object using a DataTable?