score:2

Accepted answer

jinja2 escapes all variables as a safety measure. the array of dictionaries you show is rendered by default as:

[{'f_name': 'bruce gradkowski', 'team': 'pit', 'number': 5, 'position': 'qb', 'y': 99.79, 'x': 185.42}, {'f_name': 'matthew stafford', 'team': 'det', 'number': 9, 'position': 'qb', 'y': 105.23, 'x': 190.5}]

note how the quotes were converted into html entities.

to prevent escaping you can add the safe filter as follows:

{{ var_name|safe }}

note that this only works because javascript and python happen to have a similar syntax for arrays and dictionaries.


Related Query

More Query from same tag