Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Calcul scientifique
avec Python
Voir le programme détaillé
Module « flask.json »

Fonction jsonify - module flask.json

Signature de la fonction jsonify

def jsonify(*args: 't.Any', **kwargs: 't.Any') -> 'Response' 

Description

help(flask.json.jsonify)

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 request or application 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


Vous êtes un professionnel et vous avez besoin d'une formation ? Calcul scientifique
avec Python
Voir le programme détaillé