I am building a web app on the Google App Engine platform, which uses webapp2, which uses WebOb. I would like to POST
some data in JSON format, including nested arrays and dictionaries. E.g.:
$.post('/addvendor', {'vendor': {'name': 'test', 'description': 'a good company', 'tags':['foo', 'bar']}}, function(data){console.log(data)}, 'application/json')
However, on the server side, the data comes in as a flat "MultiDict" object, not anything like the original nested JSON object that I POST
ed. E.g.:
>>> print self.request.params.items()
[(u'vendor[name]', u'test'), (u'vendor[description]', u'a good company'), (u'vendor[tags][]', u'foo'), (u'vendor[tags][]', u'bar')]
This object is very difficult to parse. In my server code, is there a way to get the same data in standard JSON format, or at least a Python equivalent using nested dictionaries and arrays, on the server so that I can manipulate and examine the data easily?