Skip to main content

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.

def jsonify(
*args: Any,
**kwargs: 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.

Parameters

NameTypeDescription
*argsAnyA single value to serialize, or multiple values to treat as a list to serialize.
**kwargsAnyKey-value pairs to be treated as a dictionary for serialization.

Returns

TypeDescription
ResponseA Flask Response object containing the serialized JSON data and the application/json mimetype.