On Mar 31, 10:05 am, Anthony <[email protected]> wrote: > You can also apply the as_dict() method to the row before returning it, as > described here:http://web2py.com/book/default/chapter/06#as_dict-and-as_list > > Anthony > >
Thanks guys. That worked. I tried as_list, and didn't consider as_dict. > > > > > > On Wednesday, March 30, 2011 10:00:05 PM UTC-4, DenesL wrote: > > > You are returning a whole record, which contains un-serializable > > objects. > > Try returning specific fields only: > > > return dict(name=db.table.name, age=db.table.age, ...) > > > On Mar 30, 9:05 pm, kedai <[email protected]> wrote: > > > On Mar 30, 11:45 pm, Jonathan Lundell <[email protected]> wrote: > > > > > On Mar 30, 2011, at 8:28 AM, kedai wrote: > > > > > > tried that, returned no json. that was my first guess too > > > > > Is the controller getting invoked? What does it do? > > > > > That ought to work, unless there's a routing problem or the like. I > > think... > > > > Here's the controller > > > > default.py > > > > def single(): > > > record = db(db.table_name.dun_id == > > > request.args(0)).select().first() > > > return dict(record=record) > > > > if I do /controller/single/N3, I got the expected result. If I do / > > > controller/single.json/N3, I got no json > > > > tia > > > > > > On Mar 30, 10:43 pm, DenesL <[email protected]> wrote: > > > > >> controller/myfunction.json/arg > > > > > >> On Mar 30, 10:01 am, kedai <[email protected]> wrote: > > > > > >>> hey guys. > > > > > >>> Q: If I have controller/myfunction; I know i can get json by doing > > > > >>> this controller/myfunction.json > > > > >>> However, I have controller/function/arg; how do I get json output > > when > > > > >>> arg will be determined when we call the function. > > > > > >>> Thanks for any pointers/help

