I'm fetching data from Mysql from table person(id, name, email). The table has many rows. I'm trying to put into a json array in a loop. But in the json array it gets overwritten with the new array.
for row in results:
persons = {
[{
'personId' : row[0],
'personName' : row[1],
'personEmail' : row[2]
},]
}
print json.dumps(persons)
can anybody give a solution?