It's not "deserialized" thus not a but but works as designed. HTTP
POST/GET parameters are only strings. Nothing more, nothing less. Django
doesn't do any magic by default.
You can use some known notation to handle your data, like JSON which can
serialize and deserialize data correctly.
--
Jani Tiainen
The alternative is to avoid using `application/x-www-form-urlencoded`, and instead use a JSON-encoded POST body. That's significantly more work on both sides, but it will allow you to send complete (typed) JSON data to your server.
On the JS side, you'll have to call $.ajax directly (rather than just $.post) using the following options:
$.ajax({
type: 'POST',
url: your-endpoint,
// This sets the POST body directly, to a JSON-encoded data structure
data: JSON.stringify(your_javascript_payload),
// jquery tries to convert your POST body through post-processing, tell it to leave your POST data as-is
processData: false,
// your callbacks
});
On the Django side, you will not be able to use request.POST. Instead, you'll have to go through `HttpRequest.raw_post_data` or to use HttpRequest as a file:
data = json.loads(request)
or
data = json.loads(request.raw_post_data)