azure-logic-apps - 逻辑应用程序-如何从动态属性名称中检索 json 数据
问题描述
这是我的 json - 在这里我想从“属性 - 动态内容”中检索 json 内容。其中,动态内容部分可能因每个 json 请求而异。如何按动态名称过滤?
{
"Attributes":
{
"Property1": {
"Data1": {
"Value": "50"
}
},
"Property2": {
"Data2": {
"Value": "50"
}
},
"Property - Dynamic content": {
"Data3": {
"Value": "50"
},
"Data4": {
"Value": "50"
}
}
} }
解决方案
对于您的要求,请参阅下面的我的逻辑应用程序:
1.我初始化了一个变量并存储了与你相同的json来模拟你的情况。
2.然后使用“解析 JSON ”。
请注意“ Parse 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"
}
请注意上面架构中的type
of Property - Dynamic content
。由于 的内容Property - Dynamic content
是“对象”或“数组”,所以我将“对象”和“数组”都设置type
为Property - Dynamic content
。
3.然后我初始化了一个名为“result”的变量来得到你想要的值。
由于我们在 的架构中同时使用类型“对象”和“数组” Property - Dynamic content
,因此您可能在“动态内容”选择中找不到它。您可以通过表达式输入其值,如上面的屏幕截图。整个表达式是:body('Parse_JSON')?['Attributes']?['Property - Dynamic content']
推荐阅读
- php - WooCommerce:将购物车中的“删除产品”链接移动到数量选择器下方,无需触摸模板
- c# - C# 将 IFormFile 读入 byte[]
- javascript - ui bootstrap append dropdown-append-to 不起作用
- c# - 查找所有 IStringLocalizer 实现,如果找不到翻译则失败
- android - 如何使用 AutoCompleteTextView 建议用户的电子邮件列表?
- python - 在numpy arra中查找值的所有序列(和最长序列)
- sql-server - Object_ID 不检测 SQL Server 中最近创建或删除的表
- cmake - CMake:如何仅在链接可执行命令中为链接库添加后缀?
- iis - ARR 代理规则问题
- javascript - 如何使用按钮切换 html 文本和背景的颜色?