title: JavaScriptSerializer().Deserialize unrecognized escape sequence
body: <p>I think I have isolated the problem but I don't know how to solve it. I'm implementing filters for my jQuery grid and when I pass the filter data to the server I get this <code>unrecognized escape sequence</code> error.</p>
  
  <p>This is the data that I send to server:</p>
  
  <pre><code>[{"field":"Code","op":"na","data":""},
  {"field":"UserId","op":"na","data":"Name\Jim"},
  {"field":"Name","op":"na","data":""}]
  </code></pre>
  
  <p>I didn't get this error until I send <code>{"field":"UserId","op":"na","data":"Name\Jim"},</code> and the only character that may cause such kind of problem in my opinion is the backslash in <code>"Name\Jim"</code>.</p>
  
  <p>I got this error here:</p>
  
  <pre><code>if (!string.IsNullOrWhiteSpace(request["filters"]))
  {
        string jsonString = request["filters"];
        filter.Rules = new JavaScriptSerializer().Deserialize&lt;FilterRule[]&gt;(jsonString);
  }
  </code></pre>
  
  <p>And more exactly from here - <code>filter.Rules = new JavaScriptSerializer().Deserialize&lt;FilterRule[]&gt;(jsonString);</code>.</p>
  
  <p>I guess I have to escape this slash somehow somewhere. I wonder where is the right place to do it and is it possible to do it server side during deserialization if that's the problem of course?</p>
  
  <p>P.S</p>
  
  <p>This is the jQuery part where I prepare the filter data :</p>
  
  <pre><code>filter.push({ field: 'UserId', op: 'na', data: $('#cboFilterUser').val() });
  </code></pre>
  
  <p>Maybe I could escape it here?</p>
  
  <p>P.S P.S</p>
  
  <p>Ok, I find some solution that works for now :</p>
  
  <pre><code> if (!string.IsNullOrWhiteSpace(request["filters"]))
              {
                  string jsonString = request["filters"];
                  jsonString = jsonString.Replace(@"\", @"\\");
                  filter.Rules = new JavaScriptSerializer().Deserialize&lt;FilterRule[]&gt;(jsonString);
              }
  </code></pre>
  
  <p>This part : <code>jsonString = jsonString.Replace(@"\", @"\\");</code> but I see it more like work around than a real solution. Please comment is this a good idea and what could possibly go wrong if I leave it like that.</p>