RESTful API - Display Returned Json In Html Table
I'm trying to do a restful api in flask and python. Here's my code: from flask import Flask, jsonify, request, render_template from flask_restful import Api, Resource app = Flask(
Solution 1:
in your application return the following:
return Response(render_template('test.html', result=test, mimetype='text/html'))
and in test.html
<!DOCTYPE html>
<html>
<head></head>
<body>
<table>
{% for key, value in result.iteritems() %}
<tr>
<th> {{ key }} </th>
<td> {{ value }} </td>
</tr>
{% endfor %}
</table>
</body>
</html>

Post a Comment for "RESTful API - Display Returned Json In Html Table"