Carl, You may find the @service.json annotation useful. Try the following: return dict(prices=prices)
Il 02 aprile 2012 11:08, Carl <m...@carlroach.com> ha scritto: > I'm looking at the example StockWatcher.java from GWT modified to use JSON > and call a Web2py server app. > > In the client app I'm > using: http://127.0.0.1:8000/init/default/stockPrices.json?q=ABC > note the ".json" extension. > > In my default.py in Web2py I have: > def stockPrices(): > sym = request.vars['q'] > rows = db(db.stock_price).select() > prices = rows.find(lambda row: row.symbol in sym).as_list() > return json.dumps(prices) > > Is there an approach in Web2py I can use that I don't need to call > json.dumps() when returning "prices" ? What are others doing?