How I can send json map object from flask and use it as javascript object?
<p>flask script</p>

<pre><code>from flask import Flask, render_template, request
import os
import sys
import json


data_raw = [('0', '1', '0', '0'), ('0', '0', '1', '0'), ('1', '0', '0', '0')]
app = Flask(__name__)

@app.route('/')
def index():
    return render_template('test.html', data=map(json.dumps, data_raw))
</code></pre>

<p>html/js script test.html</p>

<pre><code>{% extends "index.html" %}
{% block content %}

&lt;p id="test"&gt;info&lt;/p&gt;

&lt;script&gt;
var data_flask = {{ data }};
&lt;/script&gt;

{% endblock %}
</code></pre>

<blockquote>
  <p>Uncaught SyntaxError: Unexpected token &amp;</p>
</blockquote>

<p>The aim is store data_flask like this</p>

<pre><code>var data_flask = [["0", "1", "0", "0"],["0", "0", "1", "0"],["1", "0", "0", "0"]]
</code></pre>

<p>Any idea?</p>

<p>Flask, like Django, autoescapes values by default. You need to use the <code>|safe</code> filter to render the literal values.</p>

<pre><code>var data_flask = {{ data|safe }};
</code></pre>

javascript python json