title: How to remove escape characters from a JSON String
body: <p>I called a REST API with the following JSON string returned:</p>
  
  <pre><code>"{\"profile\":[{\"name\":\"city\",\"rowCount\":1,\"location\": ............
  </code></pre>
  
  <p>I tried to remove escape character with the following code before I deserialize it:</p>
  
  <pre><code> jsonString = jsonString.Replace(@"\", " ");
  </code></pre>
  
  <p>But then when I deserialize it, it throws an <code>input string was not in a correct format</code>:</p>
  
  <pre><code>SearchRootObject obj = JsonConvert.DeserializeObject&lt;SearchRootObject&gt;(jsonString);
  </code></pre>
  
  <p>The following is the complete code:</p>
  
  <pre><code>public static SearchRootObject obj()
      {
          String url = Glare.searchUrl;
          string jsonString = "";
  
          // Create the web request  
          HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
  
          // Get response  
          var response = request.GetResponse();
          Stream receiveStream = response.GetResponseStream();
  
          // Pipes the stream to a higher level stream reader with the required encoding format.
          StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);
          jsonString = jsonString + readStream.ReadToEnd();
          jsonString = jsonString.Replace(@"\", " ");
  
          // A C# object representation of deserialized JSON string 
          SearchRootObject obj = JsonConvert.DeserializeObject&lt;SearchRootObject&gt;(jsonString);
          return obj;
      }
  </code></pre>