Skip to content

Commit 3ffcc0c

Browse files
committed
python: Make Decimal types serializable using the default JSON serializer.
1 parent 5a80710 commit 3ffcc0c

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.5.15
1+
7.6.0

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
[tool.poetry]
55
name = "dazl"
6-
version = "7.5.15"
6+
version = "7.6.0"
77
description = "high-level Ledger API client for Daml ledgers"
88
license = "Apache-2.0"
99
authors = ["Davin K. Tanabe <davin.tanabe@digitalasset.com>"]

python/dazl/prim/json.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
from datetime import date, datetime
5+
from decimal import Decimal
56
import json
67

78
from .contracts import ContractId
@@ -22,6 +23,8 @@ def default(self, o):
2223
return date_to_str(o)
2324
elif isinstance(o, ContractId):
2425
return o.value
26+
elif isinstance(o, Decimal):
27+
return str(o)
2528
elif isinstance(o, UnquotedDecimal):
2629
return UnquotedDecimal(o)
2730

0 commit comments

Comments
 (0)