JSONbase64
Test if string is: valid JSON or base64 encoded valid JSON (and return decoded JSON)
npm
https://www.npmjs.com/package/@improvisedscience/json-base64
Installing
yarn add @improvisedscience/json-base64
Usage
const Parser = require("json-base64");
let payload = "eyJ0ZXN0IjoiY2FzZSJ9";
let parser = new Parser();
let ret = parser.parse(payload);
console.log(ret);
Example
https://github.com/rmrfslashbin/json-base64/blob/master/examples/index.js