title: RESTful WCF wrapping json response with method name
body: <p>I am pretty new to RESTful WCF services so bear with me. I am trying to build a simple RESTful WCF service that returns a List of Students as json response. All works well until the point where I try to convert the json string back to list of Student objects on the client.</p>
  
  <p>Here is my operation contract:</p>
  
  <pre><code>[OperationContract]
  [WebGet(UriTemplate = "Students/", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
  public List&lt;Student&gt; FetchStudents()
  {
  //Fetch and return students list
  }
  </code></pre>
  
  <p>Client code:</p>
  
  <pre><code>static void Main(string[] args)
  {
  HttpClient client = new HttpClient("http://localhost/StudentManagementService/StudentManagement.svc/");
  response = client.Get("Students/");
  response.EnsureStatusIsSuccessful();
  JavaScriptSerializer json_serializer = new JavaScriptSerializer();
  string str = response.Content.ReadAsString();
  List&lt;Student&gt; st = json_serializer.Deserialize&lt;List&lt;Student&gt;&gt;(str);
  }
  </code></pre>
  
  <p>This code obviously fails because the json string returned by the service looks like below:</p>
  
  <pre><code>{"FetchStudentsResult":[{"Course":"BE","Department":"IS","EmailID":"b@gmail.com","ID":1,"Name":"Vinod"}]}
  </code></pre>
  
  <p>For some reason the json response is getting wrapped inside the FetchStudentsResult. Now in debug mode if I forcefully remove this FetchStudentsResult wrap, my deserialization works perfectly fine.</p>
  
  <p>I have tried DataContractJsonSerializer but the result is exactly the same. Can someone tell me what am I missing?</p>