Skip to main content

dump

Serialize data as JSON and write to a file.

def dump(
obj: t.Any,
fp: t.IO[str],
kwargs: t.Any
) - > None

Serialize data as JSON and write to a file. If current_app is available, it will use its app.json.dump() method, otherwise it will use json.dump.

Parameters

NameTypeDescription
objt.AnyThe data to serialize.
fpt.IO[str]A file opened for writing text. Should use the UTF-8 encoding to be valid JSON.
kwargst.AnyArguments passed to the dump implementation.

Returns

TypeDescription
None