cancel
Showing results for 
Search instead for 
Did you mean: 

Encode Base64 JSON payload in SAP BAS

tamilselvanm
Participant
0 Kudos

Hi Guys,

I need to do the mass creation from Fiori to Backend using SAP BAS.

For that, I prepared the JSON payload in array format and need to send to backend system in Base64 format.

How to convert the below payload in Base64 format in SAP BAS.

Example Payload:

[

{ "RoleName": "ZTEST_ROLE1" },

{ "RoleName": "ZTEST_ROLE2" },

{ "RoleName": "ZTEST_ROLE3" },

{ "RoleName": "ZTEST_ROLE4" },

{ "RoleName": "ZTEST_ROLE5" }

]

Regards,

Tamilselvan

junwu
Active Contributor
0 Kudos

do you know how to use google???

AlexGourdet
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Jun,

We've been alerted and please continue to learning culture from all levels of learning.

Future comments as above don't encourage users to ask more, please refrain from that in future interaction.

regards,

Alex

View Entire Topic
tamilselvanm
Participant
0 Kudos

Hi Guys,

Please find the below answer.

Payload:

var oEntryArray = [];

var oEntry = {};

oEntry.RoleName = "ZTEST_ROLE1";

oEntryArray.push(oEntry);

var oEntry = {};

oEntry.RoleName = "ZTEST_ROLE2";

oEntryArray.push(oEntry);

To convert the above array to BASE64 format, I used the below syntax and it worked.

var base64 = btoa(JSON.stringify(oEntryArray));
Regards,Tamilselvan