We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 574c932 commit 0f1e15bCopy full SHA for 0f1e15b
src/labthings/json/encoder.py
@@ -1,6 +1,7 @@
1
# Flask JSON encoder so we get UUID, datetime etc support
2
from flask.json import JSONEncoder
3
from base64 import b64encode
4
+from collections import UserString
5
import json
6
7
@@ -20,6 +21,8 @@ def default(self, o):
20
21
return o.decode()
22
except UnicodeDecodeError: # Otherwise, base64
23
return b64encode(o).decode()
24
+ if isinstance(o, UserString):
25
+ return str(o)
26
return JSONEncoder.default(self, o)
27
28
0 commit comments