3BMLabs / building.py

Python Library for creating buildings, building systems, objects, and exporting to various programs like Blender, Revit, IFC, Struct4U, DXF & Speckle.
GNU General Public License v2.0
17 stars 3 forks source link

use serializemembers function #24

Closed JohnHeikens closed 2 months ago

JohnHeikens commented 2 months ago

serializemembers can't be used (return self.dict or looping over struct members) because:

deriving from dict itself isn't recommended

JohnHeikens commented 2 months ago

find a way to implement a serialization function which can use dict for directly serializable members, and for the rest calls a custom serialization function

JohnHeikens commented 2 months ago

for now, we are using this trick: serialized_data = json.dumps(self.objects, default=lambda x: getattr(x, 'dict', str(x)))

JohnHeikens commented 2 months ago

serialization is working! the already defined functions can still be used