[Django]-Cannot pass json in django context

3👍

Since you are trying to pass an a json representation of an array to your javascript through the django template, escapejs shouldn’t be used! It should just be

labels: {{ labels }}

note that in your view you are using the variable name json while in your template you are using labels. I assume this is a typo

If you are having trouble with quotes,

{% autoescape off %}{{ labels }}{% endautoescape %}
👤e4c5

Leave a comment