Home / Function/ dumps() — flask Function Reference

dumps() — flask Function Reference

Architecture documentation for the dumps() function in __init__.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  56a1e46e_c8cf_e780_0690_a6ca1f0e12fa["dumps()"]
  a2a0fafc_2ea9_1b29_60c7_bc4419008a44["__init__.py"]
  56a1e46e_c8cf_e780_0690_a6ca1f0e12fa -->|defined in| a2a0fafc_2ea9_1b29_60c7_bc4419008a44
  298532b3_e403_bc7d_d6ab_a15e33dea870["dumps()"]
  56a1e46e_c8cf_e780_0690_a6ca1f0e12fa -->|calls| 298532b3_e403_bc7d_d6ab_a15e33dea870
  style 56a1e46e_c8cf_e780_0690_a6ca1f0e12fa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/flask/json/__init__.py lines 13–44

def dumps(obj: t.Any, **kwargs: t.Any) -> str:
    """Serialize data as JSON.

    If :data:`~flask.current_app` is available, it will use its
    :meth:`app.json.dumps() <flask.json.provider.JSONProvider.dumps>`
    method, otherwise it will use :func:`json.dumps`.

    :param obj: The data to serialize.
    :param kwargs: Arguments passed to the ``dumps`` implementation.

    .. versionchanged:: 2.3
        The ``app`` parameter was removed.

    .. versionchanged:: 2.2
        Calls ``current_app.json.dumps``, allowing an app to override
        the behavior.

    .. versionchanged:: 2.0.2
        :class:`decimal.Decimal` is supported by converting to a string.

    .. versionchanged:: 2.0
        ``encoding`` will be removed in Flask 2.1.

    .. versionchanged:: 1.0.3
        ``app`` can be passed directly, rather than requiring an app
        context for configuration.
    """
    if current_app:
        return current_app.json.dumps(obj, **kwargs)

    kwargs.setdefault("default", _default)
    return _json.dumps(obj, **kwargs)

Domain

Subdomains

Calls

Frequently Asked Questions

What does dumps() do?
dumps() is a function in the flask codebase, defined in src/flask/json/__init__.py.
Where is dumps() defined?
dumps() is defined in src/flask/json/__init__.py at line 13.
What does dumps() call?
dumps() calls 1 function(s): dumps.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free