I have a simple code populating a list of string data from python/flask to the template.
In the rendered html, strings are within '
instead of apostrophes or double quotes. It is not a problem for the plain text, but JS cannot decode it. Do you have any idea how to solve this problem?
app.py
def index():
data = ['2021-01-13 05:35:01', '2021-01-13 05:40:02', '2021-01-13 05:45:01', '2021-01-13 05:50:02']
return render_template('index.html', data=data)
index.html - code
<body>
{{ data }}
</body>
<script>
var x = {{ data }};
</script>
index.html - rendered html
<body>
['2021-01-13 05:35:01', '2021-01-13 05:40:02', '2021-01-13 05:45:01', '2021-01-13 05:50:02']
</body>
<script>
var x = ['2021-01-13 05:35:01', '2021-01-13 05:40:02', '2021-01-13 05:45:01', '2021-01-13 05:50:02'];
</script>