I know this might be a level 0 question, but I'm stuck here
I'm using SQL Alchemy to get the sql result.
with db.connect() as conn:
data = conn.execute('''select * from tables''')
json_data = json.dumps([(dict(row.items())) for row in data])
conn.close()
return json_data
The result for the above snippet is
[{"id": 1, "name": "Ashton", "age": 20, "nationality": "US"}, {"id": 2, "name": "Kevin", "age": 20, "nationality": "US"}]
But how do I get the response with a name?
{"citizens":[{"id": 1, "name": "Ashton", "age": 20, "nationality": "US"}, {"id": 2, "name": "Kevin", "age": 20, "nationality": "US"}]}