My view computes a json and outputs a json.dumps(), and I’m passing this as the dictionary key data. I’m trying to pass this to a script element in my template, but when rendering, the browser gets it as a python-escaped string{"nodes": [{"count":...... which isn’t readable to the javascript. What I need is python to send it as a JS-escaped string, something like this {"nodes": [{"count":.......
I tried str(data) and eval(data) without success. Basically I need python to send the string just as if it were printing it to the console. Thanks
My view computes a json and outputs a json.dumps() , and I’m passing this
Share
If I understand well, you want to use a json in a template.
In order to do that, you have to disable the escaping, for exemple like this.