In the JSON below, I want replace the KEYS xyz and abc with the dynamic values of alliance and env that I am getting from the form through the below statements, replacing the words abc in quotes with straight object names below is giving me an error. Any way to achieve this?
var env = g_form.getValue('vpc_environment_type');
var alliance = g_form.getValue('alliance_business_unit');
var team = g_form.getVal`enter code here`ue('alliance_segment_team_name_df_ingestion');
var project = g_form.getValue('project_name_gcp_df_ingestion_npe');
var requestBody = {
"format_version": "0.2.19",
"alliances": {
"xyz": {
"environments": {
"abc": {
"teams": {
"dna": {
"action": "edit",
"team": "dna",
"projects": {
"xxxx": {
"project": "xxxxx",
"cost_center": "0",
"custom_iam_policies": [],
"iam": {
"dev_group_email_name": "123",
"view_group_email_name": "456",
"sre_admin_group_email_name": "789"
},
"allowed_apis": [
"123",
"123"
],
"networks": {
"xxxxx": {
"flags": [
"VM"
],
"region": "123,
"preferred-suffix" : "123"
}
}
}
}
}
}
}
}
}
}
};
requestBody = new global.JSON().encode(requestBody);
console.log(requestBody);