简体   繁体   English

逻辑应用程序 - 循环遍历 JSON 中的嵌套数组

[英]Logic Apps - looping through a nested array in JSON

I need to loop through this optional array (it's only the sectional of JSON I have trouble with).我需要遍历这个可选数组(这只是我遇到问题的 JSON 的部分)。

As you can see from the code:从代码中可以看出:

The optional bullseye has an array rings .可选的靶心有一个阵列 rings has arrays of expansionCriteria and expansionCriteria may or may not have actions . rings 有 arrays 的expansionCriteria和 expansionCriteria may or may not have actions

How do I iterate and get all type , threshold in expansionCriteria?如何迭代并获取 expansionCriteria 中的所有类型阈值 I also need to access all skillsToRemove under actions , if available.如果可用,我还需要访问actions下的所有skillsToRemove

I am rather new to Logic Apps, so any help is appreciated.我是 Logic Apps 的新手,因此非常感谢您的帮助。


        "bullseye": {
        "rings": [
          {
            "expansionCriteria": [
              {
                "type": "TIMEOUT_SECONDS",
                "threshold": 180
              }
            ],
            "actions": {
              "skillsToRemove": [
                {
                  "name": "Claims Foundation",
                  "id": "60bd469a-ebab-4958-9ca9-3559636dd67d",
                  "selfUri": "/api/v2/routing/skills/60bd469a-ebab-4958-9ca9-3559636dd67d"
                },
                {
                  "name": "Claims Advanced",
                  "id": "bdc0d667-8389-4d1d-96e2-341e383476fc",
                  "selfUri": "/api/v2/routing/skills/bdc0d667-8389-4d1d-96e2-341e383476fc"
                },
                {
                  "name": "Claims Intermediate",
                  "id": "c790eac3-d894-4c00-b2d5-90cd8a69436c",
                  "selfUri": "/api/v2/routing/skills/c790eac3-d894-4c00-b2d5-90cd8a69436c"
                }
              ]
            }
          },
          {
            "expansionCriteria": [
              {
                "type": "TIMEOUT_SECONDS",
                "threshold": 5
              }
            ]
          }
        ]
    }

Please let me know if you need more info.如果您需要更多信息,请告诉我。

To generate the schema, you can remove the name of the object at the top of the code: "bullseye":要生成架构,您可以删除代码顶部 object 的名称: “bullseye”:

Thank you pramodvalavala-msft for posting your answer in MS Q&A for the similar thread.感谢pramodvalavala-msftMS Q&A中发布类似主题的答案。

" As you are working with a JSON Object instead of an Array, unfortunately there is no built-in function to loop over the keys. There is a feature request to add a method to extract keys from an object for scenarios like this, that you could up vote for it gain more traction. “当你使用 JSON Object 而不是数组时,不幸的是没有内置的 function 来循环键。有一个功能请求添加一个方法来从 object 中提取键,对于这样的场景,你可以投票支持它获得更多牵引力。

You can use the inline code action to extract the keys from your object as an array (using Object.keys() ).您可以使用内联代码操作从 object 中提取键作为数组(使用Object.keys() )。 And then you can loop over this array using the foreach loop to extract the object that you need from the main object, which you could then use to create records in dynamics."然后你可以使用foreach 循环遍历这个数组,从主 object 中提取你需要的 object,然后你可以用它来创建动态记录。”

For more information you can refer the below links:有关更多信息,您可以参考以下链接:

. . How to loop and extract items from Nested Json Array in Logic Apps . 如何循环并从逻辑应用程序中的嵌套 Json 数组中提取项目

. . Nested ForEach Loop in Workflow. 工作流中的嵌套 ForEach 循环。 . .

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

相关问题 Azure 逻辑应用程序从单独收到的 xml 创建 JSON 数组 - Azure Logic Apps create JSON array from separate received xml 将 JSON 数组解析为 Azure 逻辑应用程序中的各个变量 - Parsing JSON array to individual variables in Azure logic apps 创建嵌套逻辑应用程序时,缺少逻辑应用程序标准工作流中的逻辑应用程序连接器操作 - Missing Logic Apps connector action from Logic Apps Standard Workflow when creating nested Logic apps 遍历从 S3 下载的 json 文件中的对象数组 - Looping through array of objects in json file downloaded from S3 在 Azure 逻辑应用程序中过滤一个数组 - Filter an array in Azure Logic Apps 在逻辑应用程序中从 sql json 中提取值 - extract value from sql json in logic apps 逻辑应用程序中的嵌套 foreach 循环不应用并发控制设置 - Nested foreach loop in Logic Apps does not apply concurrency control setting 在 Sharepoint 的父文件夹中循环时,逻辑应用返回获取文件内容的错误 404 - Logic Apps returns Error 404 for Get File Content while Looping in Sharepoint's parent folder Azure 逻辑应用程序如何将多个 JSON 文件合并到 Blob 存储 - Azure Logic Apps how to combine multiple JSON files to Blob storage 遍历二维数组 | Powershell - Looping through 2D array | Powershell
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM