逻辑应用程序将JSON数组中的数据转换为变量

发布于 2025-02-13 09:48:05 字数 938 浏览 2 评论 0原文

我正在创建一个具有Azure函数的Azure Logic应用程序,该应用程序返回以下JSON

{
"Status": "Ok",
"Message": null,
"Response": {
    "total": 1,
    "data": [
        {
            "employeeID": "123456",
            "userName": "John.Doe",
            "fullName": "John Doe",
            "legalFirstName": "John",
            "legalLastName": "Doe"
        }
    ]
}

}

我正在尝试将JSON数据转换为变量,以便能够在Azure Workflow的后续步骤中使用它们。

为此,我添加了一步以解析JSON,然后初始化一个变量。 当我添加一个值时,逻辑应用程序将初始化变量步骤嵌入到每个循环中的A中。我猜是因为返回的JSON数据在数组中。

但是,当保存逻辑应用程序以下错误时:“无法保存逻辑应用程序。 >

如何将JSON数据转换为变量?

I'm creating a Azure Logic App with a Azure function that returns the following JSON

{
"Status": "Ok",
"Message": null,
"Response": {
    "total": 1,
    "data": [
        {
            "employeeID": "123456",
            "userName": "John.Doe",
            "fullName": "John Doe",
            "legalFirstName": "John",
            "legalLastName": "Doe"
        }
    ]
}

}

I'm trying to convert the JSON data to variables to be able to use these in follow-up steps of the Azure Workflow.

For this I added I step to parse the JSON and then initialize a variable.
When I add one of the values the Logic Apps embeds the initialize variable step into a for each loop which. I guess because the JSON data returned is in a array.

However, when saving the Logic App following error is returned: "Failed to save logic app RenameTest. The variable action 'Initialize_variable' of type 'InitializeVariable' cannot be nested in an action of type 'For_each'."

How can I convert the JSON data to variables?

enter image description here

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寂寞笑我太脆弱 2025-02-20 09:48:05

查看文档

您可以创建一个变量并声明其数据类型和初始值 - 所有这些都在逻辑应用程序中的一个操作中。您只能在全球级别(不在范围,条件和循环范围内)声明变量。

因此,您需要在流程开始时创建变量。然后,您可以使用设置变量循环内部的操作将变量分配给所需值。

Looking at the documentation:

You can create a variable and declare its data type and initial value - all within one action in your logic app. You can only declare variables at the global level, not within scopes, conditions, and loops.

So you would need to create the variables at the beginning of the flow. You can then use the Set variable action inside the loop to assign the variables to the desired values.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文