diff --git a/specklepy/objects/base.py b/specklepy/objects/base.py index 1f0883a..d280bee 100644 --- a/specklepy/objects/base.py +++ b/specklepy/objects/base.py @@ -252,6 +252,9 @@ class Base(_RegisteringBase): if t is None: return value + if value is None: + return None + if t.__module__ == "typing": origin = getattr(t, "__origin__") t = ( diff --git a/specklepy/serialization/base_object_serializer.py b/specklepy/serialization/base_object_serializer.py index 9ab45dd..24516a0 100644 --- a/specklepy/serialization/base_object_serializer.py +++ b/specklepy/serialization/base_object_serializer.py @@ -60,8 +60,13 @@ class BaseObjectSerializer: chunkable = False detach = False - # skip nulls or props marked to be ignored with "__" or "_" - if value is None or prop.startswith(("__", "_")): + # skip props marked to be ignored with "__" or "_" + if prop.startswith(("__", "_")): + continue + + # allow serialisation of nulls + if not value: + object_builder[prop] = value continue # don't prepopulate id as this will mess up hashing