Skip to content

Compress index json file

While looking at the index json file, I noticed two things:

  • There are some unnecessary whitespace characters
  • The UTF-8 characters are escaped with things like \u0000 (even though json supports UTF-8)

Just running the index json file through jq can make it 20% smaller and the zip compressed file about 4% smaller. While this is not a huge improvement, it should still reduce the server bandwidth and the parsing time, while still being backwards compatible.

Demo:

$ cat index-v1.json | jq -c > index-v1-smaller.json
$ zip index-v1.zip index-v1.json
$ zip index-v1-smaller.zip index-v1-smaller.json
$ du -h *
6.1M    index-v1.jar
26M     index-v1.json
6.1M    index-v1.zip
21M     index-v1-smaller.json
5.9M    index-v1-smaller.zip
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information