8👍
✅
You should use loads()
to decode the json string to the python data:
return render(request, 'my-template.html', json.loads(data))
Or, to get only the part of the data:
decoded_data = json.loads(data)
return render(request, 'my-template.html',
{'objects': decoded_data['objects']})
And then in your template do something like this:
<ul>
{% for obj in objects %}
<li>{{ obj.name }} - {{ obj.locality }}</li>
{% endfor %}
</ul>
Source:stackexchange.com