Skip to content

Commit cafe68e

Browse files
authored
Merge pull request #4675 from tiesjan/2.1.x
Document serialization of Decimal in JSONEncoder
2 parents e4c4fd5 + 9dfcb90 commit cafe68e

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

docs/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ for easier customization. By default it handles some extra data types:
242242

243243
- :class:`datetime.datetime` and :class:`datetime.date` are serialized
244244
to :rfc:`822` strings. This is the same as the HTTP date format.
245+
- :class:`decimal.Decimal` is serialized to a string.
245246
- :class:`uuid.UUID` is serialized to a string.
246247
- :class:`dataclasses.dataclass` is passed to
247248
:func:`dataclasses.asdict`.

src/flask/json/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class JSONEncoder(_json.JSONEncoder):
2323
- :class:`datetime.datetime` and :class:`datetime.date` are
2424
serialized to :rfc:`822` strings. This is the same as the HTTP
2525
date format.
26+
- :class:`decimal.Decimal` is serialized to a string.
2627
- :class:`uuid.UUID` is serialized to a string.
2728
- :class:`dataclasses.dataclass` is passed to
2829
:func:`dataclasses.asdict`.

0 commit comments

Comments
 (0)