azure-logic-apps - 逻辑应用程序-如何从动态属性名称检索json数据

标签 azure-logic-apps

这是我的 json - 这里我想从“属性 - 动态内容”检索 json 内容。其中,动态内容部分可能因每个 json 请求而异。如何通过动态名称过滤此内容?

{
  "Attributes": 
  {
    "Property1": {
      "Data1": {
        "Value": "50"
  }
},
"Property2": {
  "Data2": {
    "Value": "50"
  }
},
"Property - Dynamic content": {
  "Data3": {
    "Value": "50"
  },
  "Data4": {
    "Value": "50"
  }
}

} }

最佳答案

对于您的要求,请参阅下面我的逻辑应用:

1.我初始化了一个变量并存储与你相同的json来模拟你的情况。

enter image description here

2.然后使用“Parse JSON ”。

enter image description here

请注意“解析 JSON”的架构显示为:

{
    "properties": {
        "Attributes": {
            "properties": {
                "Property - Dynamic content": {
                    "type": [
                        "object",
                        "array"
                    ]
                },
                "Property1": {
                    "properties": {
                        "Data1": {
                            "properties": {
                                "Value": {
                                    "type": "string"
                                }
                            },
                            "type": "object"
                        }
                    },
                    "type": "object"
                },
                "Property2": {
                    "properties": {
                        "Data2": {
                            "properties": {
                                "Value": {
                                    "type": "string"
                                }
                            },
                            "type": "object"
                        }
                    },
                    "type": "object"
                }
            },
            "type": "object"
        }
    },
    "type": "object"
}

请注意上面架构中属性 - 动态内容类型。由于Property - Dynamic content的内容要么是“object”,要么是“array”,所以我将“object”和“array”都设置为type属性 - 动态内容

3. 然后我初始化了一个名为“result”的变量来获取您想要的值。 enter image description here

由于我们在属性 - 动态内容架构中使用“对象”和“数组”类型,因此您可能在“动态内容”选项中找不到它。您可以通过表达式输入其值,如上图所示。整个表达式为:body('Parse_JSON')?['Attributes']?['Property - Dynamic content']

关于azure-logic-apps - 逻辑应用程序-如何从动态属性名称检索json数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64252280/

相关文章:

azure - 如何使用逻辑应用程序将新行添加到共享点网站内部的 csv 文件中?

azure - 如何授予应用程序创建 Azure 逻辑应用程序的权限

azure - 可以在 Service Fabric 中运行逻辑应用和 Azure Functions(或等效功能)吗?

逻辑应用中的 Azure Key Vault 用于加密或解密文件

azure - 在azure逻辑应用中对azure表存储实体进行排序

azure - 获取与逻辑应用表达式中 JSON 对象数组中的键关联的值

azure - 使用 Azure 逻辑应用从共享邮箱使用 Microsoft Graph API 发送电子邮件

Azure 逻辑应用程序 - 检查多个条件

azure - 访问 Azure 逻辑应用程序中的自定义 Blob 元数据

azure - 如何在 Azure 逻辑应用程序的 multipart/form-data 中添加多个部分