String to Base64 (string)

Hello!

I would like to convert string (API creditendials) to also string but encoded as Base64.

input string variable " aaaaa:bbbb"
output string variable “xxxxxxx”

I found this one on marketplace and it is working correctly as i needed. I input string and i receive string but encoded:

However i would like to know how to do this manually without “ready-to-use” activity from marketplace.

I tried some ideas with:

Asssign:
testString=Convert.ToBase64String

but got some errors and i`m unsure how it should looks like correctly.

Thank you in advance

Hi @Add_Bddd ,

We would first have to get the content’s in into a Byte Array format.

So we use :

InputByteArrayData = System.Text.Encoding.UTF8.GetBytes(yourStringVar)

base64Str = System.Convert.ToBase64String(byteArrayData)

To Convert Back to String :

OutputByteArrayData = System.Convert.FromBase64String(base64Str)

yourStringVar = System.Text.Encoding.UTF8.GetString(OutputByteArrayData)

The above can be done using an Assign Activity.

1 Like

Thank you Sir,
It`s working very well!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.