Answers for "encode json as base64"

1

convert json to base64 javascript

const json = { "a": 1, "b": 2 }
const string = JSON.stringify(json) // convert Object to a String
const encodedString = btoa(string) // Base64 encode the String
Posted by: Guest on June-02-2021
0

json to base64 python

data = '{"hello": "world"}'
enc = data.encode()  # utf-8 by default
print base64.encodestring(enc)
Posted by: Guest on August-01-2021

Python Answers by Framework

Browse Popular Code Answers by Language