1# In Django you need to deserialize the json
2
3import json
4def my_view(request):
5 body_unicode = request.body.decode('utf-8')
6 body = json.loads(body_unicode)
7 content = body['content']
8
1// From AJAX you need to post the data as JSON string rather than
2// a JavaScript object.
3payload = JSON.stringify({"name": "foo", "username":"bar"})
4
5$.ajax({
6 url: 'some url',
7 type: "POST",
8 // ...
9 data: payload,
10 dataType: 'json',
11 //..
12})