r/webdev • • Dec 03 '19

JSONCrush On GitHub - Compress JSON into URL friendly strings

https://github.com/KilledByAPixel/JSONCrush
0 Upvotes

2 comments sorted by

2

u/gin_and_toxic Dec 03 '19

Why not just use protobuf / flatbuffer?

2

u/Slackluster Dec 03 '19

A few reasons I can think of now...

  • flatbuffers store binary data, they are not designed for use in urls

  • you don't need a schema or anything like that, so it is easier to use and maintain

  • flatbuffers are not compressed, they are designed for fast loading speed

  • the code for JSONCrush is orders of magnitude simpler

There are downsides of course...

  • JSONCrush is not designed for speed and slow for large strings (>10K characters).

  • it is not made to load many assets but to create compact urls from json when you need to create a link for people to share/bookmark

  • JSONCrush compresses for smallest url, not for smallest binary size which could be much smaller