Convert-Base64-to-JSON

JSON to Base64

const json = { a: 1, b: 2 };
const string = JSON.stringify(json);
const encodedString = btoa(string);

Base64 to JSON

const encodedString = "eyJhIjoxLCJiIjoyfQ==";
const string = atob(encodedString);
const json = JSON.parse(string);