rows=db().select(db.realtimedata.id, db.realtimedata.FlowRate, limitby=(0, 3), orderby=~db.realtimedata.id)
data = [[row.id,row.FlowRate] for row in rows]] return json.dumps(data) On Wednesday, 11 September 2013 18:57:48 UTC-5, Sergio R. wrote: > > I'm having problem to get a valid json string for flot.js visualisation > from db data in web2py. > > This is my controller action: > > def getdata(): > return dict(data=db().select(db.realtimedata.id, > db.realtimedata.FlowRate, limitby=(0, 3), orderby=~db.realtimedata.id)) > > Generic json view returns this json string for getdata action: > > {"data": [{"id": 1, "FlowRate": 373}, {"id": 2, "FlowRate": 379}, {"id": 3, > "FlowRate": 376}]} > > How can I get this json string? > > [[1,373],[2,379],[3,376]] > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.