You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Azure Logic Apps中从指定JSON检索目标字段值的最简方法

在Azure Logic Apps中提取指定字段值的最简方法

你的数据里,sensorarray变量的值是一个字符串化的JSON,所以需要先解析成结构化对象,再提取目标字段。具体操作如下:

1. 将字符串解析为JSON对象

使用Logic Apps内置的json()函数,把sensorarray的字符串值转换为可操作的JSON结构:

json(variables('sensorarray'))

2. 提取目标字段的值

通过filter函数从properties数组中定位指定name的元素,再用first取结果并提取对应的value:

获取FailedPickupsLastHr的值

first(filter(json(variables('sensorarray'))?['ContentData']?['properties'], item()?['name'] eq 'FailedPickupsLastHr'))?['value']

获取HydraulicPressure的值

first(filter(json(variables('sensorarray'))?['ContentData']?['properties'], item()?['name'] eq 'HydraulicPressure'))?['value']

关键说明

  • ?是安全导航运算符,能避免因路径不存在导致的运行错误
  • filter函数负责筛选出数组中name匹配的对象,first取筛选结果的第一个元素(因为每个字段名唯一)
  • 直接将上述表达式粘贴到Logic Apps的输入框即可使用

内容的提问来源于stack exchange,提问作者Aniruddhya Dutta

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.19 14:20:21