title: Escape single quotes in JSON.stringify
body: <p>I know, I don't need it, but I think I actually do.</p>
  
  <p>I want to have a valid JS code rendered by <code>handlebarsjs</code> <em>before</em> it is even rendered. The JS minification tools just minify valid JS files and minifying on the fly increases processing time. This is the JS handlebars code.</p>
  
  <pre><code>var stringsObj = JSON.parse('{{{ json stringsDataObj }}}');
  </code></pre>
  
  <p>As you see, the single quotes up-there make that line of code a <em>valid</em> JS code. The <code>handlebars</code> helper is:</p>
  
  <pre><code>function json(context) {
      return JSON.stringify(context);
  }
  </code></pre>
  
  <p>And what's the problem? Well, some of the items in <code>stringObj</code> happen to have single quotes</p>
  
  <pre><code>stringsDataObj = {
    "str1": "I'm here",
    "str2": "You're there"
  }
  </code></pre>
  
  <p>and when it rendes</p>
  
  <pre><code>var stringsObj = JSON.parse('"str1": "I'm here", "str2": "You're there"');
  </code></pre>
  
  <p>gives an JS error</p>
  
  <p><strong>Is there a way to escape also single quotes in JSON.stringify?</strong>
  I tried with a replacer function, but without success.</p>