title: How do I escape backslashes in JSON?
body: <p>I am using Firefox's native JSON.parse() to parse some JSON strings that include regular expressions as values, for example:</p>
  
  <pre><code>var test = JSON.parse('{"regex":"/\\d+/"}');
  </code></pre>
  
  <p>The '\d' in the above throws an exception with JSON.parse(), but works fine when I use eval (which is what I'm trying to avoid).</p>
  
  <p>What I want is to preserve the '\' in the regex - is there some other JSON-friendly way to escape it?</p>