diff --git a/docs/api.rst b/docs/api.rst index b3cffde26f..6b02494bff 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -242,6 +242,7 @@ for easier customization. By default it handles some extra data types: - :class:`datetime.datetime` and :class:`datetime.date` are serialized to :rfc:`822` strings. This is the same as the HTTP date format. +- :class:`decimal.Decimal` is serialized to a string. - :class:`uuid.UUID` is serialized to a string. - :class:`dataclasses.dataclass` is passed to :func:`dataclasses.asdict`. diff --git a/src/flask/json/__init__.py b/src/flask/json/__init__.py index edc9793df4..adefe02dcd 100644 --- a/src/flask/json/__init__.py +++ b/src/flask/json/__init__.py @@ -23,6 +23,7 @@ class JSONEncoder(_json.JSONEncoder): - :class:`datetime.datetime` and :class:`datetime.date` are serialized to :rfc:`822` strings. This is the same as the HTTP date format. + - :class:`decimal.Decimal` is serialized to a string. - :class:`uuid.UUID` is serialized to a string. - :class:`dataclasses.dataclass` is passed to :func:`dataclasses.asdict`.