title: How to return datatable / dataset from c# web service as JSON
body: <p>I have web services returning strings as JSON by dint of using         </p>
  
  <pre>
  [WebMethod]
  [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
  </pre>
  
  <p>and calling them from the client with headers Content-type = application/json</p>
  
  <p>this was all going well until I needed to return a table of results.</p>
  
  <p>I have tried using the code here 
  <a href="http://www.west-wind.com/Weblog/posts/471835.aspx" rel="nofollow noreferrer">http://www.west-wind.com/Weblog/posts/471835.aspx</a>
  which succesfully encodes my dataset as JSON and returns a string, but this is in turn then encoded with escapes as part of the return from the .net service which is not what is wanted at all.  What type should my WebMethod return in order to get a datatable or dataset properly encoded as JSON ?</p>