I’m working with Speckle.Core.Models.Base
objects and using Speckle.Core.Serialisation.BaseObjectSerializerV2
in .NET to serialize them into JSON. However, when dealing with large IFC models, the generated JSON file can exceed 1 GB, which makes it difficult to load efficiently in speckle-viewer
on the frontend:
const loader = new SpeckleOfflineLoader(viewer.getWorldTree(), resourceData);
await viewer.loadObject(loader, true);
I’m looking for ways to minimize the JSON size while keeping the necessary data intact for the frontend to reconstruct the model.
Potential Approach
One idea I have is to restructure the JSON by replacing some objects with arrays to reduce redundancy. For example, instead of storing:
{ "Height": 5, "Width": 100 }
I could structure it like this:
[5, 100]
Then, on the frontend, I would remap the values back into their original object structure.
Are there better ways to optimize the JSON output? Does Speckle provide built-in mechanisms to handle this more efficiently?
Would really appreciate any insights or recommendations! Thanks in advance!