You can still do rows.json() even if you add columns to rows or you change their values.
On Saturday, 12 May 2012 00:27:49 UTC-5, Franklin Freitas wrote: > > If I use what you recommend then what would be the best way to generate > the JSON output > > Thanks Massimo > > > On Saturday, May 12, 2012 12:29:09 AM UTC-4:30, Massimo Di Pierro wrote: >> >> No, but you can do >> >> for row in rows: row['count'] = row[count] >> >> >> >> On Friday, 11 May 2012 23:44:57 UTC-5, Franklin Freitas wrote: >>> >>> Having the following >>> >>> def by_country(): >>> count = db.procesados.idpublicacion.count() >>> rows = db().select(db.procesados.pais, count, >>> groupby=db.procesados.pais) >>> return rows.json() >>> >>> It generates the JSON: >>> >>> [{"pais": "", "COUNT(procesados.idpublicacion)": 236}, {"pais": "AE", >>> "COUNT(procesados.idpublicacion)": 3}] >>> >>> >>> Is there a way to assign an Alias to the COUNT field so I won't have that >>> long name "COUNT(procesados.idpublicacion)" in the JSON output >>> >>> >>> >>> Thanks >>> >>>