Skip to main content

dumps

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.

def dumps(
obj: t.Any,
kwargs: t.Any
) - > str

Serialize data as JSON. If current_app is available, it will use its app.json.dumps() method, otherwise it will use json.dumps.

Parameters

NameTypeDescription
objt.AnyThe data object to be serialized into a JSON string.
kwargst.AnyAdditional keyword arguments passed to the underlying JSON provider's dumps implementation.

Returns

TypeDescription
strA string containing the JSON-formatted representation of the input object.