Command-line YAML, JSON, XML, and CSV processor with jq-like syntax for querying and transforming structured data
yq is a command-line processor for YAML, JSON, XML, CSV, INI, and other structured data formats. It uses jq-like syntax for querying and transforming data, allowing operations like reading values (.a.b[0].c), updating files in-place with -i, and merging multiple documents. The tool supports format conversion between YAML, JSON, XML, CSV, and other formats using output flags like -o json.
Built as a dependency-free Go binary, yq handles multi-document YAML files, preserves formatting and comments during updates, and supports advanced operations like array filtering, conditional updates, and environment variable substitution. It can merge files using load() functions, perform reductions across datasets, and manipulate YAML-specific features like anchors, aliases, and front matter blocks.
The tool integrates with Docker/Podman containers, GitHub Actions, and various package managers. It includes shell completion for bash/zsh/fish/PowerShell and supports piped input/output workflows. yq is particularly useful for DevOps engineers, developers working with configuration files, and CI/CD pipelines that need to manipulate structured data programmatically.
# via Homebrew
brew install yq
# via Snap
snap install yq
# via Go Install
go install github.com/mikefarah/yq/v4@latest