On Sat, 2012-01-07 at 16:06 +0100, Branko Vukelic wrote:
> Try this:
>
> # I think this the correct header
> web.header('Content-type', 'application/json')
>
> # First convert rows into a list of JSON dumps
> json_rows = [json.dumps(row) for row in db.select('foo')]
>
> # Then just join them.
> return '[%s]' % ', '.join(json_rows)
Have you tried dumping the whole list? Does it work? Like this:
# Dumping a list of rows as JSON
return json.dumps([row for row in db.select('foo')])
Let me know if this works, I'm very curious.
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.