Process YAML With yq
Query and edit YAML, JSON and XML with jq-style syntax.
Run echo 'a: 1' | yq '.a' to select a field from YAML input.
01Command
Command
$ echo 'a: 1' | yq '.a'02What it does
yq brings jq's expression language to YAML and other formats, including in-place edits with -i. It is invaluable for tweaking Kubernetes manifests, CI configs and docker-compose files straight from the shell.
03Risk
!Warning: Use -i carefully: in-place edits overwrite the original file without a backup.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- Homebrew formula: yqEvidence: Process YAML, JSON, XML, CSV and properties documents from the CLI. Packages yq, a portable jq-like processor for YAML, JSON and XML.
- Official project documentationEvidence: Packages yq, a portable jq-like processor for YAML, JSON and XML.
Last verified: 2026-09-22 · Category: Developer