如何遍历JSON对象数组中对象的一组特定属性?

在Logic App中,我有2个数组,它们都被解析为JSON {"Name":{"type":"string"},"Id":{"type":"string"}}

(Array 1)
[
   {"Id": 1,"Name": "A"},{"Id": 2,"Name": "B"},{"Id": 3,"Name": "C"},{"Id": 4,"Name": "D"},{"Id": 5,"Name": "E"}
]

(Array 2)
[
   {"Name": "A"},{"Name": "D"}
]

我有一个For循环,以@body('Array_1')作为输入。在循环内部,我首先遇到一个条件,我想检查

"expression": {
  "and": [
    {
      "not": {
        "contains": [
          "@body('Array_2')","@items('Array_1')['Name']"
        ]
      }
    }
  ]
}

换句话说,我想看看Array 2

中是否不包含某些名称。

预期结果是该条件应评估为“ true” 3次(对于name =“ B”,“ C”和“ E”),但在所有检查中均评估为true(5)。

如何遍历数组并检查属于我要迭代的项目的属性?

lluozzi 回答:如何遍历JSON对象数组中对象的一组特定属性?

您可以在逻辑应用程序中参考我的“ For Each”,如下所示: enter image description here

“ fx string()”为: enter image description here

“条件”的第二个框是: enter image description here

希望对您的问题有帮助〜

本文链接:https://www.f2er.com/3152150.html

大家都在问