yq
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.
Installation
# via Homebrew
brew install yq
# via Snap
snap install yq
# via Go Install
go install github.com/mikefarah/yq/v4@latest
Alternatives & related tools
gron
Transforms JSON into discrete assignments to make it greppable and enable exploration of complex JSON structures
fx
Terminal-based JSON processor and viewer for querying, filtering, and manipulating JSON data interactively.
usql
Universal command-line SQL client with PostgreSQL psql-inspired interface for multiple databases
miller
Command-line data processing tool for CSV, TSV, JSON, and JSON Lines with field-based operations
pup
Command line HTML processing tool using CSS selectors to filter and extract data from HTML documents
add a badge to your README
Maintain yq? Show that it's featured on trmn. The badge links back to this page.
[](https://www.trmn.sh/tools/yq?utm_source=badge)<a href="https://www.trmn.sh/tools/yq?utm_source=badge"><img src="https://www.trmn.sh/badge/yq.svg" alt="Featured on trmn" height="20"></a>