Process YAML With yq

Query and edit YAML, JSON and XML with jq-style syntax.

macOStextjsonconfigLow risk
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

RiskLow risk
CompatibilitymacOS with Homebrew installed
!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: yq
    Homebrew · vendor-doc · 2026-09-20
    Evidence: 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 documentation
    Official project · vendor-doc · 2026-09-20
    Evidence: Packages yq, a portable jq-like processor for YAML, JSON and XML.

Last verified: 2026-09-22 · Category: Developer

06Related solutions