title: Pass JSON from flask to template and decode html entity
body: <p>So I have been stuck on this for a while. I have a MongoDB that i query and return as JSON. </p>
  
  <p>I do this by:</p>
  
  <pre><code>bson.json_utils.dumps(list(all_exams.find(query))
  </code></pre>
  
  <p>I then pass this into a flask template variable to use in an inline js script in HTML.</p>
  
  <pre><code>&lt;div id="results"&gt;
    &lt;table id="results-table"&gt;
    &lt;/table&gt;
    &lt;p&gt;
       {{results_json}}
    &lt;/p&gt;
  
  &lt;/div&gt;
  
  
  &lt;script type="text/javascript" charset="utf-8"&gt;
  $('#results-table').dynatable({
  dataset: {
    records: {{results_json}}
  }
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>The problem is that in the script, the JSON cannot be parsed by denotable properly because it contains <code>&amp;#34;</code> That is the entity value for a double quote but shouldn't it not appear like that if i inspect the source code. Shouldn't the html page display it as an <code>"</code>. This only happens in the script section. Not in the <code>&lt;p&gt;</code> tag (that prints out all <code>&amp;#34;</code> as <code>"</code>).</p>
  
  <p>What am I misunderstanding?</p>