yq

15k

Command-line processor for querying, transforming, and updating YAML, JSON, XML, CSV, TOML, HCL, INI, and properties files.

$brew install yq
Language
Go
Stars
14,998
Category
Data Processing
Agent
Ready
Agent Compatibility
JSON Output
Agent Skill
MCP Support
AI Analysis

yq is a jq-like data processor for reading, reshaping, converting, and updating structured documents from files or stdin. It is most useful as a shell primitive for config files, manifests, API payloads, and multi-step pipelines that need more than plain text parsing.

What It Enables
  • Read or update nested fields in YAML, JSON, XML, TOML, HCL, INI, properties, CSV, and TSV data without writing custom parsers.
  • Merge multiple config files, create new documents from scratch, and rewrite files in place for automation or repo maintenance tasks.
  • Convert between structured formats and emit JSON or line-delimited JSON for downstream tools, scripts, or agent follow-up steps.
Agent Fit
  • Flags, stdin support, exit behavior, and non-interactive eval or eval-all commands make it easy to slot into shell loops and CI jobs.
  • Machine-readable output is solid: explicit input and output format flags, JSON output, and compact single-line JSON reduce parsing friction for agents.
  • Best used as a data-shaping primitive around other CLIs and files, where an agent needs to inspect config state, apply deterministic edits, and verify the result.
Caveats
  • It does not implement all of jq, so some filters or edge-case expectations will not transfer directly.
  • Round-tripping comments and whitespace is best-effort rather than exact, especially in more complex YAML or XML cases.