#27415: Add request.JSON or request.get_json() -------------------------------------+------------------------------------- Reporter: Ustun | Owner: nobody Ozgur | Type: New | Status: new feature | Component: Core | Version: 1.10 (Serialization) | Keywords: json, request, Severity: Normal | incoming data Triage Stage: | Has patch: 0 Unreviewed | Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -------------------------------------+------------------------------------- If the content-type is application/json, the body should be parsed and put on request object as JSON or json field (or retrieved via a method like get_json).
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. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/048.bad85e70bae0ed9acc89cd4abee6677d%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.