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

如何在Azure Logic Apps中从JSON提取单个值?提取无结果求助

JSON单值提取失败的解决方案
  • 先明确你的JSON结构:目标值嵌套在data数组的第一个元素中,示例结构如下:
    {"data":[{"id":1,"name":"John","email":"john@example.com"}]}
    
  • 错误原因:直接提取顶层字段(比如name),跳过了data数组这一层,导致无法获取目标值
  • 正确提取方式示例:
    • JavaScript:
      // 假设解析后的JSON对象为response
      const targetValue = response.data[0].name;
      
    • Python:
      import json
      json_content = '{"data":[{"id":1,"name":"John","email":"john@example.com"}]}'
      parsed_data = json.loads(json_content)
      target_value = parsed_data['data'][0]['name']
      
    • 其他语言逻辑一致:先定位到data数组,再取对应索引的元素,最后提取目标字段

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.27 20:39:58