This is what flask does, and should be supported for convenience since it
is nowadays very common to ingest JSON.
I have seen several proposals in this regard, but those seem over generic
(ability to support multiple parsers etc.) and work on them seems to have
stalled or moved to libraries.
Solving the majority case where people use JSON should be good enough.
I have searched the open tickets, but haven't been able to find a
duplicate which just focuses on JSON.
https://code.djangoproject.com/ticket/21442
https://github.com/django/deps/blob/master/draft/content-negotiation.rst
https://flask.readthedocs.io/en/latest/api/#flask.Request.get_json
The json class might be configurable so that people can use ujson instead
of stock json for perf if needed.
--
Ticket URL: <https://code.djangoproject.com/ticket/27415>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by Simon Charette):
Hi Unstun,
Thanks for your suggestion but I believe we should focus on making
`request.data` available based on the `Content-Type` header like described
in the DEP you linked instead of adding a `JSON` attribute on request that
would be removed in the mid-term. In the meantime you can write a
middleware that adds a `JSON` attribute on request with the appropriate
content-type if you want to rely on that.
--
Ticket URL: <https://code.djangoproject.com/ticket/27415#comment:1>
* status: new => closed
* resolution: => wontfix
* component: Core (Serialization) => HTTP handling
--
Ticket URL: <https://code.djangoproject.com/ticket/27415#comment:2>