I have a response output of a API call:
{
"orgName": null,
"roleNames": [
"TenantDashboardOperator",
"TenantOperator",
"TenantSecurityAdmin",
"TenantSuperAdmin"
]
}
When I add the output to a variable, using test script like this:
postman.setEnvironmentVariable("TenantRoles",jsonRBData.roleNames);
The value of TenantRoles variable gets set to the output above, but without the Double Quotes, since it becomes like an array.
Is it possible to create another variable, that has a value as the output of the roleNames, but with all quotes?
For example, for the above output, the value needs to be " “TenantDashboardOperator”, “TenantOperator”, “TenantSecurityAdmin”, “TenantSuperAdmin”. So essentially, I want to append the Double quotes and the comma to create a new variable.
The reason I am trying to do that is that the length of the array variable can be dynamic and based on the output, I need to pass this to another request like below:
{
"versanms.sdwan-org-workflow":{
"cpeDeploymentType":"SDWAN",
"globalId": {
orgID
}
},
"ikeAuthType":"{{ikeAuthType}}",
"orgName":"{{newOrgName}}",
"sharedControlPlane":false,
"supportedRoles":[
"TenantDashboardOperator",
"TenantOperator",
"TenantSecurityAdmin",
"TenantSuperAdmin"
]
}
As you can see above, I need quotes for each of the values to be passed in the request for it to pass.
Thanks,
Suraj