From 7be55e446f07667d1950d6b68d77db5ee86b9284 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Thu, 2 Mar 2023 21:58:26 +0100 Subject: [PATCH] Convert UUID objects to strings when serializing to JSON. --- platypush/message/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platypush/message/__init__.py b/platypush/message/__init__.py index 28879b1a95..39095ea85f 100644 --- a/platypush/message/__init__.py +++ b/platypush/message/__init__.py @@ -7,6 +7,7 @@ import inspect import json import time from typing import Union +from uuid import UUID logger = logging.getLogger('platypush') @@ -60,6 +61,9 @@ class Message: if isinstance(obj, set): return list(obj) + if isinstance(obj, UUID): + return str(obj) + value = self.parse_numpy(obj) if value is not None: return value