title: C# winform: serialize/deserialize JSON data coming from REST service to use in application
body: <p>I have Grid view and binding it to the data calling from REST based web service.
  REST service is giving it in JSON format, so how i can deserialize and use for my grid?</p>
  
  <p>Here is the most of code I have,</p>
  
  <pre><code>public ICollection&lt;Employee&gt; GetEmployees()
      {
          var request = HttpWebRequest.Create(GetEndPointAddress("GetEmployeeService"));
          var response = request.GetResponse();
          var stream = response.GetResponseStream();
          var serializer = new DataContractSerializer(typeof(ICollection&lt;Employee&gt;));
          var employees = serializer.ReadObject(stream) as ICollection&lt;Employee&gt;;
          response.Close();
          return employees;
      }
  
  public Uri GetServiceBaseAddress
      {
          get
          {
              return new Uri("http://localhost/Employeeservices/api");
  
          }
      }
  
  private Uri GetEndPointAddress(string relativeAddress)
      {
          return new Uri(GetServiceBaseAddress.ToString() + "/" + relativeAddress);
      }
  </code></pre>
  
  <p>I am getting below error:</p>
  
  <p>There was an error deserializing the object of type System.Collections.Generic.ICollection`1[[EmployeeApp.Models.Employee, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]. The data at the root level is invalid. Line </p>
  
  <p>Also, how can I post the data back to the service if I make changes to any of these data?</p>