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

如何在JSONPath查询中使用相等运算符过滤出type为error的消息?

解决JSONPath过滤type为error条目的问题

要实现只提取issues数组中type为error的条目及其type和message字段,你需要在原JSONPath查询中添加过滤条件。

正确的JSONPath查询语句

@.records[*].issues[?(@.type == 'error')].[type, message]

语句解释

  • records[*]:遍历所有records数组中的记录项
  • issues[?(@.type == 'error')]:针对每个记录的issues数组,筛选出**当前元素的type属性等于'error'**的条目。这里的@代表正在遍历的issues元素本身
  • .[type, message]:从过滤后的元素中提取type和message两个字段

执行结果

运行上述查询后,你会得到仅包含error类型的结果:

[
  [
    "error",
    "[SQ] Task failed with status FAILED, Error message: Fail to extract report AYOEa2gdtfNdJFd6edM9 from database"
  ]
]

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.27 15:54:05