#
Create a QR code for WiFi
Write custom encoder class:
class UUIDEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, uuid.UUID):
# if the obj is uuid, we simply return the value of uuid
return obj.hex
elif isinstance(obj, datetime.date):
return obj.strftime("%d.%m.%Y")
return json.JSONEncoder.default(self, obj)
Use it with
json.dumps(obj, cls=UUIDEncoder)