You're not really sending JSON to the server. When you pass the object to jQuery.ajax
(or the get
/post
wrappers), it will be serialized into GET or POST variables, not sent as JSON, so your object would be converted into something like this:
a=text&b=othertext&c[]=texta&c[]=textb
If you want to pass the entire object as JSON, you can convert it yourself by calling JSON.stringify
(you will need to include json2.js for browsers that don't support the JSON
object natively). Then you can wrap the JSON-encoded string in a map with whatever name you want:
jQuery.post(url, { json: JSON.stringify({a:'text', ...}) }, ...);
On the server side, you can access the JSON text by calling self.request.get("json")
. Then you would have to parse the JSON string to extract the values. I don't know much about Python, but apparently you just need to import django.utils.simplejson
and call simplejson.loads(json)
.