How to convert map into base 64 json string?

I have a map and I want to convert it to json then base64 encode that so that it is a string. How would I do that?

Hey @joshua.aug what have you tried so far?

1 Like

You can use the Jason library to do the encoding, followed by Base.encode64/1.

map = %{a: 1}
map |> Jason.encode!() |> Base.encode64()

There are other ways… it all depends.