[web2py] Re: Request vars - basic question

2015-02-21 Thread Massimo Di Pierro
we choose an unfortunate name for gluon.serializers.json I can see how that can create confusion. On Saturday, 21 February 2015 06:03:24 UTC-6, clara wrote: Hello all, Massimo, I tried the same, I saved request.vars.input into a file and tried:from a python console:imported json and

[web2py] Re: Request vars - basic question

2015-02-21 Thread clara
Hello all, Massimo, I tried the same, I saved request.vars.input into a file and tried:from a python console:imported json and json.loads worked fine. You nailed the problem: I imported the wrong json module: I changed the imports from: *from gluon.serializers import json* to: *from

Re: [web2py] Re: Request vars - basic question

2015-02-20 Thread Michele Comitini
Clara I'd suggest to use the full json service support of web2py, makes everything easier do the following: make sure you have the call() method you can find in default.py controller of welcome application then write a method like this in default.py: def dothetest(): return dict()

[web2py] Re: Request vars - basic question

2015-02-20 Thread Massimo Di Pierro
I tried this data = '{input:[{the_owner:1,category:1,name:La marcha del oro,price:44.45,id:1,quantity:100},{the_owner:3,category:3,name:Toy Story,price:34.56,id:2,quantity:23},{the_owner:2,category:2,name:La

[web2py] Re: Request vars - basic question

2015-02-20 Thread clara
Hello all, Thanks all for the responses and sorry for the delay in my response. I was struggling with this and I don't get to solve it yet. The data (string) passed to the controller as *request.vars.input *looks good but it fails when I try to load it with json.loads. This is what I have at

Re: [web2py] Re: Request vars - basic question

2015-02-20 Thread Richard Vézina
Clara, May it be possible that specifying datatype in your ajax call be the poblem? You stringify if then you say that it is an json type to ajax... I would try by removing the datatyep: 'json' line completly in the above and see if request.vars.input is now a plain string of the json you

[web2py] Re: Request vars - basic question

2015-02-20 Thread Derek
It doesn't appear to be a string object anymore, you have a python dictionary object. Try this.. print type(request.vars.input) On Friday, February 20, 2015 at 11:19:55 AM UTC-7, clara wrote: Hello, I am making an Ajax call and calling a controller with the json data I need to process in

Re: [web2py] Re: Request vars - basic question

2015-02-20 Thread Richard Vézina
but what is : print 'request.vars.input'?? To me it should print : request.vars.input hein!! Clara would you copy/paste your exact code here? Richard On Fri, Feb 20, 2015 at 2:00 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: No a list of python dict :) Richard On Fri, Feb

Re: [web2py] Re: Request vars - basic question

2015-02-20 Thread Richard Vézina
No a list of python dict :) Richard On Fri, Feb 20, 2015 at 1:27 PM, Derek sp1d...@gmail.com wrote: It doesn't appear to be a string object anymore, you have a python dictionary object. Try this.. print type(request.vars.input) On Friday, February 20, 2015 at 11:19:55 AM UTC-7, clara