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 flask.current_app is available, it will use its app.json.dump() method, otherwise it will use json.dump.

Parameters

NameTypeDescription
objt.AnyThe data object to be serialized into JSON format.
fpt.IO[str]A file-like object opened for writing text, which should use UTF-8 encoding to ensure valid JSON output.
kwargst.AnyAdditional keyword arguments passed to the underlying JSON dump implementation.

Returns

TypeDescription
NoneNothing is returned; the serialized data is written directly to the provided file object.