title: print JSON string converted from python object using flask
body: <p>I have this flask server running and i made this html file which has a script where when i clicked the button it will return a JSON string. However it kept giving me undefined instead.
  I have this app.py code which gives me a python dict which i converted it to JSON</p>
  
  <pre><code>@app.route('/')
  def helloworld():
      #result = jsonify(student)
      html_item = json.dumps(Marks, indent=2, separators=(', ', ': '))
      return render_template('test1.html',data = html_item)
  </code></pre>
  
  <p>after this on the test1.html i have a script </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;  
  &lt;html&gt;  
      &lt;head&gt;  
          &lt;title&gt;  
              JavaScript | Print content of object 
          &lt;/title&gt; 
      &lt;/head&gt;  
  
      &lt;body style = "text-align:center;" id = "body"&gt;  
  
          &lt;h1 style = "color:rgb(0, 2, 128);" &gt;  
             {{data}}
          &lt;/h1&gt; 
  
          &lt;p&gt; 
              Print JavaScript Object. 
          &lt;/p&gt; 
  
          &lt;button onclick = "gfg_Run()"&gt;  
              print object 
          &lt;/button&gt; 
  
          &lt;p id = "GFG_DOWN" style 
                  = "color:rgb(0, 2, 128); font-size: 20px; font-weight: bold;"&gt; 
          &lt;/p&gt; 
  
          &lt;script&gt; 
              var el_down = document.getElementById("GFG_DOWN"); 
  
              var GFG_object = { 
                  prop_1: 'val_11', 
                  prop_2: 'val_12',  
                  prop_3: 'val_13' 
              }; 
  
              function gfg_Run(data) {  
                  el_down.innerHTML = data;
                  //el_down.innerHTML = JSON.stringify(GFG_object); 
              } 
  
          &lt;/script&gt;  
      &lt;/body&gt;  
  &lt;/html&gt;    
  
  
  </code></pre>
  
  <p>where I have tested that it can print out a js object by the line I commented out.
  How should I print out a JSON string which in my case <code>data</code>properly?</p>