yq

Command-line YAML, JSON, XML, and CSV processor with jq-like syntax for querying and transforming structured data

install
demo

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

add a badge to your README

Maintain yq? Show that it's featured on trmn. The badge links back to this page.

Featured on trmn
Markdown
[![Featured on trmn](https://www.trmn.sh/badge/yq.svg)](https://www.trmn.sh/tools/yq?utm_source=badge)
HTML
<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>