jsonify() — flask Function Reference
Architecture documentation for the jsonify() function in __init__.py from the flask codebase.
Entity Profile
Dependency Diagram
graph TD 8e862ec3_d7f5_8775_bc74_975e27aa89cb["jsonify()"] a2a0fafc_2ea9_1b29_60c7_bc4419008a44["__init__.py"] 8e862ec3_d7f5_8775_bc74_975e27aa89cb -->|defined in| a2a0fafc_2ea9_1b29_60c7_bc4419008a44 aec4f243_b66b_1e41_ea9e_51f8c611233d["response()"] 8e862ec3_d7f5_8775_bc74_975e27aa89cb -->|calls| aec4f243_b66b_1e41_ea9e_51f8c611233d style 8e862ec3_d7f5_8775_bc74_975e27aa89cb fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/flask/json/__init__.py lines 138–170
def jsonify(*args: t.Any, **kwargs: t.Any) -> Response:
"""Serialize the given arguments as JSON, and return a
:class:`~flask.Response` object with the ``application/json``
mimetype. A dict or list returned from a view will be converted to a
JSON response automatically without needing to call this.
This requires an active app context, and calls
:meth:`app.json.response() <flask.json.provider.JSONProvider.response>`.
In debug mode, the output is formatted with indentation to make it
easier to read. This may also be controlled by the provider.
Either positional or keyword arguments can be given, not both.
If no arguments are given, ``None`` is serialized.
:param args: A single value to serialize, or multiple values to
treat as a list to serialize.
:param kwargs: Treat as a dict to serialize.
.. versionchanged:: 2.2
Calls ``current_app.json.response``, allowing an app to override
the behavior.
.. versionchanged:: 2.0.2
:class:`decimal.Decimal` is supported by converting to a string.
.. versionchanged:: 0.11
Added support for serializing top-level arrays. This was a
security risk in ancient browsers. See :ref:`security-json`.
.. versionadded:: 0.2
"""
return current_app.json.response(*args, **kwargs) # type: ignore[return-value]
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does jsonify() do?
jsonify() is a function in the flask codebase, defined in src/flask/json/__init__.py.
Where is jsonify() defined?
jsonify() is defined in src/flask/json/__init__.py at line 138.
What does jsonify() call?
jsonify() calls 1 function(s): response.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free