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

Power Automate基于字符串值筛选数组问题排查

Power Automate Filter Array 筛选空输出问题排查与解决

问题原因

你遇到的空输出问题确实是字符串与布尔值类型不匹配导致的:
输入JSON里的acceptsEmail是字符串类型的"true"/"false",但你设置的筛选条件是让它等于布尔值false。Power Automate的比较判断严格区分类型,字符串"false"和布尔值false会被判定为不相等,因此没有符合条件的项被筛选出来。

解决方法

有两种可行的修正方式:

  • 直接匹配字符串:在Filter array的条件中,将右侧的比较值改为字符串形式的"false"(输入时直接写"false",确保Power Automate识别为字符串而非布尔值)。此时筛选条件为:
    item()?['preferences']?['acceptsEmail'] 等于 "false"
    
  • 转换类型后匹配布尔值:使用bool()表达式将字符串转为布尔值,再和布尔值false比较。此时筛选条件的左侧表达式改为:
    bool(item()?['preferences']?['acceptsEmail'])
    
    右侧保持布尔值false即可。

参考输入JSON

[
  {
    "id": "123",
    "email": "testemail@icloud.com",
    "mobilePhone": "",
    "countryCode": "TR",
    "preferences": {
      "acceptsEmail": "true"
    }
  },
  {
    "id": "1234",
    "email": "testemail@hotmail.com",
    "mobilePhone": "",
    "countryCode": "BE",
    "preferences": {
      "acceptsEmail": "false"
    }
  }
]

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.14 07:37:05