xeokit-convert icon indicating copy to clipboard operation
xeokit-convert copied to clipboard

JSON compression for metadata?

Open xeolabs opened this issue 3 years ago • 2 comments

There are many repeated strings in the metadata JSON. Perhaps compress using: https://coderwall.com/p/mekopw/jsonc-compress-your-json-data-up-to-80

xeolabs avatar Sep 22 '22 08:09 xeolabs

An idea - factor strings out into a lookup table within the metadata JSON.

In the snippet below, the integer values for those properties are indexes into the string dictionary. We could also treat the property names in the same way.

{
  "dictionary": [
    "IfcWindow",
    "IfcDoor",
    "1E1QVUnGb7UwbYyT0lPilv",
    "Window",
    "1E1QVUnGb7UwbYyT0lPilv",
    "1E1QVUnGb7UwbYyT0lPilv",
    "Door"
  ],
  "metaObjects": [
    {
      "id": 2,
      "name": 3,
      "type": 0
    },
    {
      "id": 4,
      "name": 6,
      "type": 1,
      "parent": 2
    }
  ]
}

xeolabs avatar Sep 22 '22 20:09 xeolabs

We do something like the second option at BIMData. It is fast and the complexity of rebuilding usable data from the JSON isn't high.

Amoki avatar Sep 23 '22 08:09 Amoki