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