如何将HTTP输出主体循环到逻辑应用程序以将每一行保存在Excel工作表中?

问题描述

如何为该逻辑应用程序考虑JSON模式,并传递array(以下模式为'result')。 应该会为每个u_brand,u_platform,名称和其他所有值获取更新excel工作表行

1。创建了excel表格 2.触发http主体传递到JSON解析 3.使用for循环并选择先前步骤的输出。 4.在excel表格中传递每个数据

出现错误 ExpressionEvaluation失败。模板操作'For_each'的执行失败:'foreach'表达式'@body('Parse_JSON')'的求值结果为'Object'类型。结果必须是有效的数组。

{
  "body": {
    "result": [
      {
        "number": "","u_brand": {
          "display_value": "A"
        },"location.full_name": "north America/north America/north America MCO/United States","name": "username","location": {
          "display_value": "United States"
        },"u_platform": {
          "display_value": "TWH"
        },"u_brand.u_division": "Corporate"
      },{
        "number": "","u_brand": {
          "display_value": "B"
        },"location.full_name": "Latin America/Latin America/Brazil/Brazil","name": "username2","location": {
          "display_value": "Brazil"
        },"u_platform": {
          "display_value": "Adobe"
        },"u_brand.u_division": "Food and Refreshment"
      }
]
}
}

image:
  [1]: https://i.stack.imgur.com/aThcg.png

解决方法

请在result中使用For each

enter image description here

如果您使用Body,它将使用body循环,而body是Object类型。

Json模式如下:

{
    "properties": {
        "body": {
            "properties": {
                "result": {
                    "items": {
                        "properties": {
                            "location": {
                                "properties": {
                                    "display_value": {
                                        "type": "string"
                                    }
                                },"type": "object"
                            },"location.full_name": {
                                "type": "string"
                            },"name": {
                                "type": "string"
                            },"number": {
                                "type": "string"
                            },"u_brand": {
                                "properties": {
                                    "display_value": {
                                        "type": "string"
                                    }
                                },"u_brand.u_division": {
                                "type": "string"
                            },"u_platform": {
                                "properties": {
                                    "display_value": {
                                        "type": "string"
                                    }
                                },"type": "object"
                            }
                        },"required": [
                            "number","u_brand","location.full_name","name","location","u_platform","u_brand.u_division"
                        ],"type": "object"
                    },"type": "array"
                }
            },"type": "object"
        }
    },"type": "object"
}