JSONCrush – Compress JSON into URL friendly strings

I just open sourced an amazingly useful tool called JSONCrush. This simple system allows for excellent compression of uri encoded JSON strings using the JSCrush algorithm. The minified version is under 2k of JavaScript!

JSONCrush on GitHub

Example

JSON – 103 bytes

{"students":[{"name":"Jack","age":17},{"name":"Jill","age":16},{"name":"Sue","age":16}],"class":"math"}

URI Encoded Component – 199 bytes

%7B%22students%22%3A%5B%7B%22name%22%3A%22Jack%22%2C%22age%22%3A17%7D%2C%7B%22name%22%3A%22Jill%22%2C%22age%22%3A16%7D%2C%7B%22name%22%3A%22Sue%22%2C%22age%22%3A16%7D%5D%2C%22class%22%3A%22math%22%7D

JSONCrushed – 82 bytes! 59% smaller

('students!%5B*Jack-7)%2C*Jill-6)%2C*Sue-6)%5D~class!'math')*('name!'-'~age!1%01-*
This entry was posted in JavaScript and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.