CLI Finder / tools / jq

用于 Agent 工作流 JSON 处理的 jq

轻量、可脚本化的 JSON 处理器,适合 Agent 查看 API 响应、包文件和日志。

Agent 适配度: 95/100 持续维护
95 /100

One of the safest and most useful CLIs for agents that inspect JSON.

Structured output 100/100

Whether the CLI can return JSON, YAML, or stable machine-readable output.

Non-interactive use 96/100

Whether common workflows can run predictably without an interactive prompt.

Safety boundaries 90/100

Whether read-only, dry-run, scoped auth, and destructive command boundaries are clear.

安装方式

Homebrew $ brew install jq
Debian/Ubuntu $ sudo apt install jq
Windows $ winget install jqlang.jq

常用命令

Read a field · 安全 $ jq -r '.name' package.json

Extracts one value from JSON.

Filter array items · 安全 $ jq '.items[] | select(.status == "open")'

Filters structured arrays.

Overwrite a file · 需确认 $ jq '.version = "1.0.1"' package.json > tmp && mv tmp package.json

Changes a file and should be treated as an edit.

Agent 使用示例

Codex CLI Use jq for JSON inspection and small transformations. Show the filter before overwriting files.

安全说明

  • jq is read-only unless shell redirection overwrites a file.
  • Agents should avoid complex filters when a simpler projection is enough.
  • Use -e when exit codes need to signal missing or invalid values.

Agent 可以用它做什么

jq 可以让 Agent 不写临时解析器,也能稳定查看和转换 JSON。

适合场景

适合 API 响应、包元数据、日志、锁文件,以及任何支持 JSON 输出的命令。