Hi Kevin, Maybe you could try using web.data() <http://webpy.org/cookbook/postbasic>instead of web.input(). You would then need to parse this using the json parser <http://docs.python.org/2/library/json.html> from the standard library.
import json postData = web.data() parsedData = json.loads(postData) On Fri, Nov 2, 2012 at 3:18 AM, Kevin Jiang <[email protected]> wrote: > Hi Guys, > > I use jQuery post the json data like this: > > postData = {'id': 12, 'data': [{'name': 'myname', 'value': 'myvalue'}, > {'name': 'myname2', 'value': 'myvalue2'}]}; > $.post(url, postData, function(){}); > > At the backend, I got the post data like following use web.input(): > postData = web.input() > print postData > > <Storage {'data[0][name]': u'myname', 'data[0][value]': u'myvalue', > 'data[1][name]': u'myname2', 'data[1][value]': u'myvalue2', 'id': u'12'}> > > I only can get postData.id, how can get the data list directly. > > Thanks. > > -- > You received this message because you are subscribed to the Google Groups > "web.py" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/webpy/-/ozmmfxgOuYIJ. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/webpy?hl=en. > -- You received this message because you are subscribed to the Google Groups "web.py" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/webpy?hl=en.
