Unable to use JSON.parse in my django template
<p>I have a variable data1 in my Django view which has been returned in the following way -</p>

<pre><code>def dashboard(request):
   df1 = pd.read_excel("file.xlsx")
   str1= df1.to_json(orient = 'records')
   data1 = json.loads(str1)
   return render(request, 'dashboard/new 1.html',{'data1' : data1})
</code></pre>

<p>The variable is then called in the template using javascript</p>

<pre><code> &lt;script type = text/javascript&gt;    
   var ob2 = JSON.parse( {{ data1 }} );
   document.write(ob2);
 &lt;/script&gt;
</code></pre>

<p>This does not show anything on the HTML webpage created. Is there anything wrong in the code?</p>

<p>Try this by remove <code>Parse</code></p>

<pre><code> &lt;script type = text/javascript&gt;    
   document.write("{{ data1 }}");
 &lt;/script&gt;
</code></pre>

javascript python json django