在 Bot Framework Composer 中将简单数组添加到 JSON 有效负载
我有一个简单的问题,在使用 Bot Framework Composer 时,我无法在 json 负载中插入数组来调用图形 api 来更新用户配置文件。
示例:
Step1. 我创建了一个属性 Conversation.UpdatedSkills,它包含以下值
["SharePoint","Dotnet","Analytics"]
现在我想为 MS Graph 服务构建 JSON 对象,工作示例有效负载如下所示。
{
"skills":["SharePoint","Dotnet","Analytics"]
}
步骤2。现在要动态构建此 JSON,我需要在“发送 HTTP 请求”活动中将正文作为 JSON 对象传递,并且我有以下代码来生成有效负载。
{
"skills":"${conversation.UpdatedSkills}"
}
Step2 的输出看起来像这样。
{
“skills”: “[\r\n “SharePoint”,\r\n “Dotnet”,\r\n “Analytics”\r\n]”
}
所需的 JSON 是这样的:
{
"skills":["SharePoint","Dotnet","Analytics"]
}
我的问题是,如何从步骤 1 传递我的数组,以便它创建在服务中工作的 json 对象。使用步骤 2 创建的对象不是服务采用的正确对象。
有什么想法吗?
我尝试了不同的字符串操作,但我认为这是基本的,并且必须有一些东西。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要使用字符串插值
${ }
,而是使用表达式 (=
)。对于上面的示例,它应该是:Don't use the string interpolation
${ }
, but use an expression (=
). For your example above, it should be: