Created
November 4, 2021 21:58
-
-
Save htr3n/6d4109849672879f6a40f298b29df872 to your computer and use it in GitHub Desktop.
Create an object from a base64 encoded input JSON string in Node.js
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
const inputStr = ... ; // a base64 encoded string | |
if (inputStr) { | |
const decodedStr = Buffer.from(inputStr, 'base64').toString('utf8'); | |
const result = JSON.parse(decodedStr); | |
if (result) { | |
// ... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment