9
JSONCrush – Compress JSON into URL friendly strings
source link: https://frankforce.com/jsoncrush-compress-json-into-uri-friendly-strings-with-jscrush/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
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. It seems almost like magic how well it works. 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 – 81 bytes! 59% smaller
('students!%5B*Jack-7.Jill-6.Sue-6)%5D~class!'math')*('name!'-'~age!1.)%2C*%01.-*
Like this:
Loading...
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK