Home / Function/ dump() — flask Function Reference

dump() — flask Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  ee72fb03_7af7_1da4_8dfe_846e50fd9f0e["dump()"]
  a2a0fafc_2ea9_1b29_60c7_bc4419008a44["__init__.py"]
  ee72fb03_7af7_1da4_8dfe_846e50fd9f0e -->|defined in| a2a0fafc_2ea9_1b29_60c7_bc4419008a44
  8f13dd58_25bc_a85c_2acf_75a1c258d4e4["dump()"]
  ee72fb03_7af7_1da4_8dfe_846e50fd9f0e -->|calls| 8f13dd58_25bc_a85c_2acf_75a1c258d4e4
  style ee72fb03_7af7_1da4_8dfe_846e50fd9f0e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/flask/json/__init__.py lines 47–74

def dump(obj: t.Any, fp: t.IO[str], **kwargs: t.Any) -> None:
    """Serialize data as JSON and write to a file.

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

    :param obj: The data to serialize.
    :param fp: A file opened for writing text. Should use the UTF-8
        encoding to be valid JSON.
    :param kwargs: Arguments passed to the ``dump`` implementation.

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

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

    .. versionchanged:: 2.0
        Writing to a binary file, and the ``encoding`` argument, will be
        removed in Flask 2.1.
    """
    if current_app:
        current_app.json.dump(obj, fp, **kwargs)
    else:
        kwargs.setdefault("default", _default)
        _json.dump(obj, fp, **kwargs)

Domain

Subdomains

Calls

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free