Document serialization of Decimal in JSONEncoder
The Flask JSONEncoder serializes Decimal types to strings, but this behavior is missing from the docs. The docs are updated accordingly.
This commit is contained in:
parent
e4c4fd5771
commit
9dfcb90c92
2 changed files with 2 additions and 0 deletions
|
|
@ -242,6 +242,7 @@ for easier customization. By default it handles some extra data types:
|
||||||
|
|
||||||
- :class:`datetime.datetime` and :class:`datetime.date` are serialized
|
- :class:`datetime.datetime` and :class:`datetime.date` are serialized
|
||||||
to :rfc:`822` strings. This is the same as the HTTP date format.
|
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:`uuid.UUID` is serialized to a string.
|
||||||
- :class:`dataclasses.dataclass` is passed to
|
- :class:`dataclasses.dataclass` is passed to
|
||||||
:func:`dataclasses.asdict`.
|
:func:`dataclasses.asdict`.
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ class JSONEncoder(_json.JSONEncoder):
|
||||||
- :class:`datetime.datetime` and :class:`datetime.date` are
|
- :class:`datetime.datetime` and :class:`datetime.date` are
|
||||||
serialized to :rfc:`822` strings. This is the same as the HTTP
|
serialized to :rfc:`822` strings. This is the same as the HTTP
|
||||||
date format.
|
date format.
|
||||||
|
- :class:`decimal.Decimal` is serialized to a string.
|
||||||
- :class:`uuid.UUID` is serialized to a string.
|
- :class:`uuid.UUID` is serialized to a string.
|
||||||
- :class:`dataclasses.dataclass` is passed to
|
- :class:`dataclasses.dataclass` is passed to
|
||||||
:func:`dataclasses.asdict`.
|
:func:`dataclasses.asdict`.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue