title: How to pass data to javascript in flask\jinja environment?
body: <p>I am using VS code in a Windows 10 environment to debug a python flask\jinja application.</p>
  
  <p>Python code pass data to html page without issue and <code>{{ formDict }}</code> displays data correctly.  Debugging shows there are data passed to javascript.  However, running to this line</p>
  
  <pre><code>var dict = json.stringfy('{{ formDict|tojson|safe }}');
  </code></pre>
  
  <p>generates this error</p>
  
  <blockquote>
    <p>toJson is not defined </p>
  </blockquote>
  
  <p>Is this VS code issue that not load jinja or some other problem? Any recommendation how to resolve it?</p>
  
  <p>Python code:</p>
  
  <pre><code>formDict = {"firstname": "Eric", "lastname": "Smith"}
  return render_template("appointment.html",formDict=formDict)
  
  
  html file - appintment.html
      &lt;!DOCTYPE html&gt;
      &lt;html lang="en" dir="ltr"&gt;
      &lt;head&gt;
          &lt;meta charset="utf-8"&gt;
          &lt;title&gt;&lt;/title&gt;
          &lt;script&gt;    
              function createPointOption () {
                  var dict = json.stringfy('{{ formDict|tojson|safe }}');
                  ......  
              }   
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body onload="creatPointOption()"&gt;
          ....
          &lt;p id="test"&gt;{{formDict}}&lt;/p&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>