[web2py] Re: the way to return json

2017-09-19 Thread Anthony
On Monday, September 18, 2017 at 9:59:32 PM UTC-4, 黄祥 wrote: > > a, i c, not tested on that yet, will do, btw, > forgot to add service.json() not sure about the difference or performance > compare with json/simplejson, as_json(), response.json(), restful > Again, ultimately, it just calls

[web2py] Re: the way to return json

2017-09-18 Thread 黄祥
a, i c, not tested on that yet, will do, btw, forgot to add service.json() not sure about the difference or performance compare with json/simplejson, as_json(), response.json(), restful e.g. @service.json def service_json_call_json_rows(): query = (db.auth_user.id > 0) rows = db(query).select()

[web2py] Re: the way to return json

2017-09-18 Thread Anthony
On Monday, September 18, 2017 at 9:09:59 AM UTC-4, 黄祥 wrote: > > yes you are right .as_list() will be called automatically when pass it to > response.json() > > rows.as_json() work well too unfortunately it's not documented in book yet: > def json_rows_as_json(): > query = (db.auth_user.id > 0) >

[web2py] Re: the way to return json

2017-09-18 Thread 黄祥
yes you are right .as_list() will be called automatically when pass it to response.json() rows.as_json() work well too unfortunately it's not documented in book yet: def json_rows_as_json(): query = (db.auth_user.id > 0) rows = db(query).select() return rows.as_json() *not sure about :*

[web2py] Re: the way to return json

2017-09-17 Thread Anthony
gluon.contrib.simplejson is not really simplejson but just a dummy module that calls the Python json module, so no difference between the first and second. I suspect response.json will be similar to json.dumps. response.json is gluon.serializers.json, which ultimately calls json.dumps, but it