Adding simple array to JSON payload in Bot Framework Composer

Viewed 374

I have a simple problem where I am not able to insert an array in json payload to call graph api to update user profile while using Bot Framework Composer.

Example:

Step1. I created a property Conversation.UpdatedSkills which holds following value

["SharePoint","Dotnet","Analytics"]

Now I want to build JSON object for MS Graph service and working sample payload looks like this.

{
   "skills":["SharePoint","Dotnet","Analytics"]
}

Step2. Now to build this JSON dynamically, I need pass body as JSON Object in Send an HTTP Request activity and I have folllowing code to generate payload.

{
    "skills":"${conversation.UpdatedSkills}"
}

The output from Step2 looks something like this.

{

    “skills”: “[\r\n “SharePoint”,\r\n “Dotnet”,\r\n “Analytics”\r\n]”

}

DESIRED JSON WAS THIS:

 {
       "skills":["SharePoint","Dotnet","Analytics"]
 }

My question is, How do I pass my array from step 1 such a way so that it creates json object that works in service. The object created using step 2 is not the right object that service takes.

Any idea?

I tried different string manipulations but I think this is basic and there has to be something.

1 Answers

Don't use the string interpolation ${ }, but use an expression (=). For your example above, it should be:

{
  "skills": "=conversation.UpdatedSkills"
}
Related