Convert UUID objects to strings when serializing to JSON.

This commit is contained in:
Fabio Manganiello 2023-03-02 21:58:26 +01:00
parent 15fadb93bb
commit 7be55e446f
Signed by: blacklight
GPG Key ID: D90FBA7F76362774
1 changed files with 4 additions and 0 deletions

View File

@ -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