I solved the problem: from gluon.globals import json
@request.restful() def getOrder(): response.view = 'generic.json' def GET(*args,**vars): patterns = [ "/p/:idOrder" ] # ..... res = {} res.update({'response': {'success': True, 'Key': Key, 'data': dataOrder, 'Code': .....}}) return (json(res)) return dict(GET=GET) Thanks. Regards Francisco. El viernes, 12 de mayo de 2017, 9:25:44 (UTC+2), Francisco García escribió: > > El jueves, 11 de mayo de 2017, 19:53:29 (UTC+2), Anthony escribió: >> >> Please show your code. >> > > Hi Anthony, > Thanks for your answer. > > My code is: > > ----------------------------------------- > @request.restful() > def getOrder(): > response.view = 'generic.json' > > def GET(*args,**vars): > patterns = [ > "/p/:idOrder" > ] > > # ..... > res = {} > res.update({'response': {'success': True, 'Key': Key, 'data': > dataOrder, 'Code': .....}}) > return dict(res) > > return dict(GET=GET) > --------------------------------------------- > > This way I can't return 'response' expression. > > Thank you for your support. > Regards, > Francisco > > > >> >> On Thursday, May 11, 2017 at 12:28:37 PM UTC-4, Francisco García wrote: >>> >>> Hello all, >>> >>> In a service Restful I need to return a dict in the form: >>> >>> {'response' : {'data' : .....}} >>> >>> The problem is that I can't use 'response' Keyword this way. >>> I get the error: >>> keyword can't be an expression >>> I would like to know if there is a way to do that. >>> Thank you in advance. >>> >>> Regards, >>> Francisco >>> >>> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.