2👍
✅
in views.py
def my_view(request,...):
...
render("my_template.html",context={"xyz_list":[[1,2,3],[2,3,4],[4,5,6]]})
in my_template.html
...
<script>
var xyz_data_array = {{ xyz_list }} ;
</script>
note that this only works because the array is made up of simple primatives … if the data contained was more complicated than numbers or simple strings this likely would not work
Source:stackexchange.com