Docs: clarify JSON request Content-Type requirement

This commit is contained in:
G 2026-01-31 17:34:18 +05:30
parent 2579ce9f18
commit 280e0aaee8

View file

@ -709,6 +709,11 @@ This is a shortcut to passing the data to the
:func:`~flask.json.jsonify` function, which will serialize any supported :func:`~flask.json.jsonify` function, which will serialize any supported
JSON data type. That means that all the data in the dict or list must be JSON data type. That means that all the data in the dict or list must be
JSON serializable. JSON serializable.
.. note::
When sending JSON requests, clients must include the
``Content-Type: application/json`` header.
Otherwise, ``request.get_json()`` may return ``None``.
For complex types such as database models, you'll want to use a For complex types such as database models, you'll want to use a
serialization library to convert the data to valid JSON types first. serialization library to convert the data to valid JSON types first.