
yq
A command-line tool for reading and editing YAML, JSON, XML, CSV and other data files.
- Stars
- 16.2k
- Forks
- 2.1k
- Licence
- MIT
- Language
- Go
- Last update
- 9 days ago
- Type
- CLI
What it is
yq is a command-line program that reads structured data files such as YAML, JSON, XML, CSV, TSV, INI and properties, and lets you pull out or change values using a jq-like query syntax. People use it in scripts, build pipelines and config management to inspect or update settings without editing files by hand. The README describes it as a lightweight, dependency-free binary written in Go.
- Read a nested value from a YAML file, for example with yq '.a.b[0].c' file.yaml
- Update a value in place with yq -i and a set expression
- Set a value from an environment variable using strenv()
- Merge multiple YAML files into one output
- Convert a JSON file to pretty-printed YAML
Great for
- Developers who regularly edit YAML config files in scripts or CI pipelines
- DevOps engineers updating Kubernetes or deployment manifests from the command line
- Anyone converting between formats, such as JSON to YAML or XML to YAML
- People already familiar with jq who want similar syntax for YAML
Not ideal for
- Users who need full jq compatibility, since the README says it does not yet support everything jq does
- People who only edit files in a text editor and never script changes
- Anyone needing a graphical interface, as this is a command-line tool only
How to get it
- 1
Install with a package manager
Install with Homebrew (macOS / Linux)
brew install yqInstall with Snap (Linux)
snap install yqInstall with Go
go install github.com/mikefarah/yq/v4@latest - 2
Run it
- Install yq using one of the methods listed in the README
- Run yq --version to confirm the install worked
- Read a value with yq '.a.b[0].c' file.yaml, replacing the path with one from your own file
- Update a file in place with yq -i '.a.b[0].c = "cool"' file.yaml
- 3
Get the most out of it
- Use strenv(NAME) with NAME set in your environment to inject values into files
- Merge several files with the ea command and a glob pattern, as shown in the README
- Use -o json or -o yaml to convert between formats
- Run it through Docker or Podman with the README's example commands if you do not want a local install
- Browse the linked recipes and gitbook documentation for more examples
Downloads
Strengths
- Single downloadable binary with no dependencies, according to the README
- Supports many formats beyond YAML, including JSON, XML, CSV and TOML per the description
- Familiar jq-style syntax for users who already know jq
Trade-offs
- Does not yet implement everything jq does, per the README
- Some install routes, such as the Debian package, are noted as no longer maintained
- The README excerpt is truncated, so some details of supported formats and options are not fully covered here
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| yq (this) | 16.2k | CLI | beginner | 9 days ago | Developers who regularly edit YAML config files in scripts or CI pipelines |
| cli | 24.3k | Library | intermediate | 5 days ago | Go developers writing a command line tool with subcommands and flags |
| oh-my-posh | 23.7k | Dev tool | intermediate | 5 days ago | Developers who want their terminal prompt to show extra context |
| telegraf | 17.9k | App | intermediate | 4 days ago | Engineers setting up server or system monitoring |
| gjson | 15.6k | Library | beginner | 1 months ago | Go developers who need a few fields from a JSON response without writing struct definitions |
| go | 13.9k | Library | beginner | 2.4 years ago | Go developers who parse or produce large amounts of JSON and want to test a faster option |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.