简体   繁体   English

power automate 的表达式问题 (JSON)

[英]Expression issues (JSON) with power automate

I'm working on power automate and I have an issue because I've tried a lot expressions and none of them working.我正在研究电力自动化,但我遇到了一个问题,因为我尝试了很多表达式,但没有一个起作用。

I did a loop (foreach) and inside a message (compose) and there I tried to display "f7626790-0756-43bf-a757-a645a33b853d" from"client"我做了一个循环 (foreach) 并在消息中 (compose) 并在那里我尝试显示来自“客户端”的“f7626790-0756-43bf-a757-a645a33b853d”

To do so, I've tried all those expressions:为此,我尝试了所有这些表达式:

  • item()?['client']项目()?['客户']
  • item()?['client']?[0] item()?['客户']?[0]
  • item()['client']项目()['客户']

在此处输入图像描述

Here my json file:这是我的 json 文件:

[
    {
        "gift": [
            {
                "client": "f7626790-0756-43bf-a757-a645a33b853d",
                "details": [
                    {
                        "client_id": 10859085,
                        "type": "christmas",
                        "application_id": "6e6d758d-8e74-3ae3-ac84-50eb23ae65f"
                    }
                ]
            }
        ]
    }
]

Thank's in advance.提前致谢。

Based on the JSON you provided, you have two arrays. So the question for me is, which array do you want to iterate?根据你提供的JSON,你有两个arrays。所以我的问题是,你想迭代哪个数组? Both or the inner one?两者还是内部?

I'm going to assume both or if not, it won't matter if you only ever have one item for both of them, my answer will still retrieve the client property.我将假设两者都假设,如果不是,如果你只有一个项目,那也没关系,我的回答仍然会检索client财产。

结果

  • The Initialize Data step has your JSON. Initialize Data步骤有您的 JSON。

  • The Initialize Client step is a blank string at this stage. Initialize Client步骤在这个阶段是一个空白字符串。

  • The For Each Outer Item expression is simply a link to the Data variable as initialized in the first step. For Each Outer Item表达式只是指向第一步中初始化的Data变量的链接。

  • The For Each Gift expression is set as... item()?['gift'] ... as you can work out, that will loop over each gift item. For Each Gift表达式设置为... item()?['gift'] ... 正如您所计算的那样,它将遍历每个gift项。

  • Finally, I get the value of the client property using this expression... item()['client']最后,我使用此表达式获取client属性的值... item()['client']

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM