Change the format of the returned data when selecting records. Flask : <p>In my flask application, in routes.py I get entries with specific fields of the <code>Location</code> model:</p>

<pre><code>...
location = db.session.query(Location.id, Location.name,Location.code, Location.id_parent).all()
newLocat = list( location)
print(str(newLocat))
...
</code></pre>

<p>The format of the returned data is as follows:</p>

<pre><code>[(1, 'Test1', 101, 0), (2, 'Test2', 202, 1)]
</code></pre>

<p>How to make the returned data format look like this?</p>

<pre><code>[{'id': '1', 'name': 'Test1','code':101, 'id_parent': '0'}, {'id': '2', 'name': 'Test2','code':202, 'id_parent': '1'}]
</code></pre>
