Python
import json
import base64
data = {'success': 0, 'message': 'ok', 'data': [i for i in range(10)]}
enc_data = base64.b64encode(json.dumps(data).encode())
# b'eyJzdWNjZXNzIjogMCwgIm1lc3NhZ2UiOiAib2siLCAiZGF0YSI6IFswLCAxLCAyLCAzLCA0LCA1LCA2LCA3LCA4LCA5XX0='
base64.b64decode(enc_data)
# b'{"success": 0, "message": "ok", "data": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}'
JavaScript
https://www.npmjs.com/package/crypto-js
https://www.npmjs.com/package/js-base64
import * as CryptoJS from 'crypto-js';
import * as Base64 from 'crypto-js/enc-base64';
var words = CryptoJS.enc.Base64.parse('eyJzdWNjZXNzIjogMCwgIm1lc3NhZ2UiOiAib2siLCAiZGF0YSI6IFswLCAxLCAyLCAzLCA0LCA1LCA2LCA3LCA4LCA5XX0=')
var data = words.toString(CryptoJS.enc.Utf8)
// '{"success": 0, "message": "ok", "data": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}'
JSON.parse(data)
// {"success": 0, "message": "ok", "data": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}
import { decode as b64decode } from 'js-base64';
import { Base64 } from 'js-base64';
b64decode('aGVsbG8gd29ybGQ=');
Base64.decode('aGVsbG8gd29ybGQ=');