I've got a response object as a result of a GET
request and I've converted this to JSON
with jsonify()
. When I pass this to a template, all I get is a JSON object like: <Response 1366 bytes [200 OK]>
this.
#request.py
...
response = requests.get('http://www.example.com')
response_json = jsonify(all=response.text)
return render_template(
'results.html',
form=ReqForm(request.form),
response=response_json,
date=datetime.datetime.now()
)
and the template..
#results.html
...
<div class="results">
{{ response }} # --> gives <Response 1366 bytes [200 OK]>
</div>
...
How can I pretty display this JSON in a template?