class JSONEncoder(_json.JSONEncoder):
The default JSON encoder. Handles extra types compared to the
built-in json.JSONEncoder
.
datetime.datetime
and datetime.date
are
serialized to RFC 822 strings. This is the same as the HTTP
date format.uuid.UUID
is serialized to a string.dataclasses.dataclass
is passed to
dataclasses.asdict
.~markupsafe.Markup
(or any object with a __html__
method) will call the __html__ method to get a string.Assign a subclass of this to flask.Flask.json_encoder
or
flask.Blueprint.json_encoder
to override the default.
Method | default |
No summary |
json.JSONEncoder.default
. Python does not support
overriding how basic types like str or list are
serialized, they are handled before this method.Parameters | |
o:t.Any | Undocumented |
Returns | |
t.Any | Undocumented |