title: Jinja Flask issue: Uncaught SyntaxError: Unexpected token { in JSON at position 1 at JSON.parse
body: <p>Hi I've got an issue passing a simple variable from Flask app to javascript. My python looks as follows:</p>
  
  <pre><code>@app.route('/')
  def loadInitialData():
  
      data={"grade":"0"}
  
      return render_template('index.html', data= json.dumps(data))
  </code></pre>
  
  <p>My javascript looks like this:</p>
  
  <pre><code>var data = JSON.parse('{{ data }}');
  console.log(data);
  </code></pre>
  
  <p>And I keep getting this error:</p>
  
  <p>VM24:1 Uncaught SyntaxError: Unexpected token { in JSON at position 1
      at JSON.parse ()</p>