yq

CLI>=4.0

A lightweight YAML, JSON, and XML processor.

Query and edit YAML/JSON/XML files like jq for YAML

5 of 5 recipes verified by execution · 2026-09-17#yaml#json#xml#query

Verified commands

Executed by our harness on the platforms shown; the assertion checked the actual result, not just the exit code.

Read a YAML value

Verified macOS · Linux · 2026-09-17
yq '.services.web.ports[0]' compose.yml
Common failures (1)
  • Error: unknown command / different syntaxthese recipes target mikefarah yq v4 (brew/apt yq). The Python yq (pip) uses jq syntax instead.

Edit a YAML value in place

Verified macOS · Linux · 2026-09-17
yq -i '.spec.replicas = 3' deploy.yaml

Append an item to a YAML list in place

Verified macOS · Linux · 2026-09-17
yq -i '.list += ["c"]' config.yaml

Convert YAML to JSON

Verified macOS · Linux · 2026-09-17
yq -o=json '.' config.yaml

Convert JSON to YAML

Verified macOS · Linux · 2026-09-17
yq -p=json -o=yaml '.' data.json

Install

Homebrewbrew install yq

Agent notes

When to use
Editing Kubernetes manifests, CI config, or any YAML files
Quick examples
  • yq '.spec.replicas' deploy.yaml
  • yq -i '.version = "2.0"' config.yaml

Use from an agent

curl -s https://clihub.com/api/tools/yq | jq '.agentHints.provenRecipes[] | {task, command, verified}'

Or call get_tool with slug yq on the MCP server at https://clihub.com/mcp.

Homepage ↗MIT0 views