Skip to content

Commit 848eb1b

Browse files
handle sets and frozen sets in json serialization (#61)
Co-authored-by: looselycoupled <allen.leis@gmail.com>
1 parent 398bcdc commit 848eb1b

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

btrdb/utils/conversion.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ def default(self, obj):
5757
# https://numpy.org/devdocs/reference/arrays.datetime.html#changes-with-numpy-1-11
5858
return pytz.utc.localize(obj.astype(datetime)).strftime(RFC3339)
5959

60+
# handle sets and frozensets
61+
if isinstance(obj, (set, frozenset)):
62+
return list(obj)
63+
6064
# Let the base class default method raise the TypeError
6165
return json.JSONEncoder.default(self, obj)
6266

0 commit comments

Comments
 (0)