title: De-serialize byte array to JSON
body: <p>I have a WCF implemented with REST to get and return JSONs and I am trying to call its methods from a winform app.</p>
  
  <p>I am checking on Fiddler to know whether I am being able to send the data or not and if I get a response.</p>
  
  <p>Everything looks fine, I am sending a JSON to the web service and I am getting back a JSON..the problem is when I try to de-serialize it..</p>
  
  <p>The returned JSON looks like :</p>
  
  <p><img src="https://i.stack.imgur.com/tD3wc.png" alt="enter image description here"></p>
  
  <p>So as you  can see I am getting data ** data returned**..I just dont know how to read it.
  I am trying the following :</p>
  
  <pre><code>var serializer = new DataContractSerializer(typeof(wcfPicture), null, int.MaxValue, false, true, null, null);
      byte[] res1 = WC.UploadData(ServiceUrl + "newImage", "POST", MS.ToArray());
      var stream = new MemoryStream(res1);
      var deserializedObjectXml = serializer.ReadObject(stream);
  </code></pre>
  
  <p>This is throwing me : There was an error deserializing the object of type wcfPicture. The data at the root level is invalid. Line 1, position 1.</p>
  
  <p>I am also trying : </p>
  
  <pre><code>    byte[] res1 = WC.UploadData(ServiceUrl + "newImage", "POST", MS.ToArray());
                      Stream res2 = new MemoryStream(res1);
                      JSrz = new DataContractJsonSerializer(typeof(wcfPicture));
  wcfPicture pI2 = (wcfPicture)JSrz.ReadObject(res2);
  </code></pre>
  
  <p>But the problem is that pI2 values are the default values of each property type..the strings are equal to "" and the integers are equal to 0..so I dont know what is actually going on..</p>
  
  <p>Any help?</p>