title: JsonConvert.DeserializeObject throw exception when retrieving JSON from Rest API
body: <p>I have an issue I cannot solve. I have a nodejs server that can send a simple json through a REST API.</p>
  
  <pre><code>var filename = 'latestVersion.json';
  fs.readFile(filename, 'utf8', function (err, data) {
       if (err) throw err;        
       filejson = JSON.parse(data.toString('utf8').replace(/^\uFEFF/, ''));
       res.json(data);
  });
  </code></pre>
  
  <p>I then retrieve the json in my C# application:</p>
  
  <pre><code>class AppVersion
  {
     public int major { get; set; }
     public int minor { get; set; }
     public int build { get; set; }
  }
  
  HttpWebRequest http = (HttpWebRequest)HttpWebRequest.Create(new Uri(url));
  HttpWebResponse response = (HttpWebResponse)http.GetResponse();
  string versionString = null;
  using(System.IO.StreamReader sr = new System.IO.StreamReader(response.GetResponseStream()))
  {
     versionString = sr.ReadToEnd();
  }
  if(versionString != null)
  {
     AppVersion test = new AppVersion() { major = 1, minor = 1, build = 1 };
     string testStr = JsonConvert.SerializeObject(test);
     var j = JsonConvert.DeserializeObject&lt;AppVersion&gt;(versionString);
  }
  </code></pre>
  
  <p>I then have an exception "Cannot cast or convert...." when deserializing. However, if I use the <code>testStr</code> everything goes well. Then I looked at the strings and found this :</p>
  
  <pre><code>testStr = "{\"major\":1,\"minor\":1,\"build\":1}"
  versionString = "\"﻿{\\\"major\\\": 1, \\\"minor\\\": 1, \\\"build\\\": 1}\""
  </code></pre>
  
  <p>More strange, I tried to edit the <code>versionString</code> by hand removing the extra escape characters and I got still an error (the JSON visualizer says that it is badly formatted).</p>
  
  <p>Any clue to solve this ?</p>