Constructing post body request

objective is to build the below in mapper
“input”: [
{
“key”: “plan”,
“value”: “ProvisioningPlan”,
“type”: “application/xml”
},
{
“key”: “identityName”,
“value”: “88E2EA18-6C15-E811-8BB4-0017A47705CA”
},
{
“key”:“flow”,
“value”:“AccessRequest”
},
{
“key”: “launcher”,
“value”: “D12D1C44-7D41-EB11-80E8-0017A4774018”
}
]

with the below expression i am unable to reuse keys… any recommendations ?

sl.ensureArray({}.extend({key:‘plan’,value:‘provisioning plan’,type:‘application/xml’}))

image

Try this:

$input.map(x=>x.extend({"type":"application/xml"}))

I’m not sure that this is what you want to achieve, so, if not, share some more details, or a sample output.

this didn’t work… i am trying to build body (using mapper) which will go in the post rest’s HTTP entity field

and this is the body i am trying to create

“input”: [
{
“key”: “plan”,
“value”: “ProvisioningPlan”,
“type”: “application/xml”
},
{
“key”: “identityName”,
“value”: $identityNameValue
},
{
“key”:“flow”,
“value”:“AccessRequest”
},
{
“key”: “launcher”,
“value”: $launcherValue
}
]

this expression sl.ensureArray({}.extend({key:‘plan’,value:‘provisioning plan’,type:‘application/xml’})) is proving me (to an extent) what i am trying to achieve, however i noticed “key” and “value” cannot be repeated hence i am looking for recommendations