Last active
August 27, 2024 11:21
-
-
Save kouks/3a5f83f26343d209d58364946e336bbc to your computer and use it in GitHub Desktop.
Encodes and/or decodes data as base64 url safe string.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Encodes a js object as a url-safe base64 string. | |
encodeURIComponent(btoa(JSON.stringify({ ... }))) | |
// Takes the previously generated string and returns a parsed js object. | |
JSON.parse(atob(decodeURIComponent('...'))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment