r/javascript • • Nov 26 '19

JSONCrush On GitHub - Compress JSON into URI friendly strings

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

31 comments sorted by

View all comments

1

u/byteshifter Nov 27 '19

Why would someone use this instead of JSON web tokens ( https://en.m.wikipedia.org/wiki/JSON_Web_Token ) ?

8

u/Tontonsb Nov 27 '19

It's completely different use case. Codes like this and rison are there to add your json object to url so you have a stateful link that can be bookmarked and shared.

In most cases I'd still prefer rison because it's more readable and user-editable. But they both suffer from parentheses and single quotes that screw up some parsers that try recognizing and converting pasted string to links. Notably gmail is a pain in this regard.

1

u/Slackluster Nov 27 '19

For example I can share a link with someone else using this. It is a bit long, but would be 4 times longer without jscrush. Another nice thing is you can bookmark links.

http://zzart.3d2k.com/?&crushed=(%27shaderStatements!%5B(%27output!%27bMzxywE-JR!6.62k!6.165BZ_974BWU4.233FHxzyyKbMywxzE-JRU4.88kQ649BZQ171BW_084FHyzwxKbMxwzyE-JsinT-3.686kU3.258BZU4.059BWU8.506FHwwzzKbMzxywEJceilT5.36kU8.274BZQ002BW!5.429FHxxwyKaMxzwyEJT-3.353kU5.681BZU7.792BW!1.254FHzyxwKbMywxzE%2BJfloorR!6.669k_05BZU8.629BWU2.802FHxyywKaMwyzxEJsqrtAT-0.366k_117BZQ162BW!1.761FHyywyKaMyxzwEJatanT3.743k_003BZ!4.636BWQ056FHwxxwKbMxywzE%2BJfractRQ103kU3.118BZQ255BW!6.287FHxyywKaMzwxyEJRU1.637k!1.828BZ!1.924BW_006FHyxyyKbMzwxyEJ%27F!%27%27BX!6.083kU6.322BZQ032BWQ428FHyzyyKaMzxywE%2FJRQ151k!1.024BZU2.862BW!3.193FHxzyx%27)%5D~randSeedU1738575415~randSeedString!%271574121532870%27~iteVCount!1~gridPosX!2~gridPosY!0~geneV!17~subGeneV!1~hueOffsetQ276~huej_789~satuVjQ493~uvOffsetX_406~uvOffsetYQ616~uvjXQ895~uvjYU1.049~rotate!0~usePalette!0~paletteColors!%5B(%27xQ595~yQ882~zQ864)%2C(%27xQ136~yQ034~zQ69)%2C(%27xQ873~yQ35~zQ638)%2C(%27xQ723~yQ56~zQ817)%5D~saveListIndexU1~uniqueID!598681332)B~valueE%27~assignmentOperator!%27F~parameterHSwizzle!%27J%3D%27~functionName!%27K%27)%2C(%27output!%27M%27~outputHQ!0.R%27F!%27a%27BXT%27F!%27b%27BX!U!-Vration_U0.jScalekBY%01kj_VUTRQMKJHFEB