This has me stumped. I'm trying to apply the function as posted and trying 
to get rid of the trailing comma to ensure valid json. The 
following doesn't work:
 
def GET(self): 
  web.header('Content', 'text/json') 
  rows = db.select('foo') 
  lrows = len(rows)
  yield '[' 
  for i,row in enumerate(rows): 
    if i < lrows:
       yield json.dumps(row) + ', ' 
    else:
       yield json.dumps(row)
  yield ']' 
any suggestions on how to handle the trailing comma? 
TIA
 

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/webpy/-/omqXZVblaZgJ.
To post to this group, send email to webpy@googlegroups.com.
To unsubscribe from this group, send email to 
webpy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to