- take your
minified JSON
and turn it into a URL safe base64 string. The length of this string can be as big as this. - make a dummy url like
http://dummy.tld/<the base64 string>
and shorten it using any URL shortener. - save the unique path of the shortened url as your compressed data (henceforth called token). No need to store the domain of the shortened URL as the URL shortener would be hardcoded in your app.
- Reconstruct the shortened URL from the token. Try to fetch (GET) the shortened URL.
- Parse the response for the redirect url and extract the base64 string.
- Decode the base64.