I was wondering if there might be a way to return my Flask app's response as an HTML table populated by the JSON response key value pairs instead of merely having the entire JSON string on the HTML page?
Below is the code that i have:
from flask import Flask
import json, pandas as pd
app = Flask(__name__)
@app.route("/GetData")
def GetData():
df = pd.read_csv("DemoData.csv")
temp = df.to_dict('records')
data = [dict(i) for i in temp]
return json.dumps(data, indent=4)
if __name__ == "__main__":
app.run(host='127.0.0.1', port=8000)
The code above gives the following response: (URL: "http://127.0.0.1:8000/GetData")
Now what i want is to get the response converted into a table upon entering the aforementioned URL kinda like the CSV file.
Here is a sample of my CSV file:
Employee Name,City,Country,Project Assigned Carl Elias,Passadena,USA,Optical Character Recognition Amanda Jean Spears,Denver,USA,Linux Kali Security Mods John Reese,Athens,Greece,Inertial Navigation System Leslie James,Heartfordshire,United Kingdom,Relay Transmission Optimisation Mods Patrick Sullivan,London,United Kingdom,Fraud Checking System Julia Reginald Roberts,Sao Paolo,Brazil,User Authentication System Michael Bucannan,San Franscisco,USA,Analytics Automation Tool Jeanine Fitzgerald,Ontario,Canada,CopyChecker Patricia Sullly,Shanghai,China,Automated Milling Tool

df.columnshas the CSV columns in order, you can use them in your template.