I need a clarification. If I for example do a view with a serialized object:
def sample(request):
res = [{'name':'man'}]
encoded = json.dumps(res)
return render_to_response('sample/example.html',{'encoded':encoded} )
In my templates I pass:
{{encoded}}
Now from a python script can I do:
data = json.loads(urllib2.urlopen(url/to/site).read()
It says ValueError: No JSON object could be decoded. But isn't {{encoded}} a json object? And if so how would I get it?
Thank you
Try this in your template:
{% autoescape off %}
{{ encoded }}
{% endautoescape %}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With