yq

yq

Portable Go command-line processor using jq-like syntax to query, edit in place, and convert YAML, JSON, XML, TOML, and CSV files.

★ 16.4K

Edit Kubernetes YAML, TOML, and XML configs in place with familiar jq syntax

Updating an image tag or environment variable inside a 400-line `docker-compose.yml` or Helm `values.yaml` file using `sed` risks breaking indentation or wiping out inline YAML comments. yq (maintained by Mike Farah in Go) brings `jq`-style expression syntax to YAML, JSON, XML, CSV, TOML, HCL, and Java properties files with zero external dependencies. Backed by 16.4K GitHub stars and 1,500 forks under the MIT license, it is a staple in modern GitOps and CI/CD pipelines.

Why DevOps engineers rely on mikefarah/yq

  • Comment-preserving in-place edits (`yq -i ‘.image.tag = strenv(NEW_TAG)’ values.yaml`) update specific YAML nodes while leaving surrounding comments and blank lines untouched.
  • Multi-document and glob merging (`yq ea`) combines base Kubernetes manifests and environment overrides cleanly in a single command.
  • Format conversion flags (`-o=json`, `-p=xml -o=yaml`, `-o=props`) translate freely between YAML, JSON, XML, TOML, and CSV inside shell pipelines.
  • String environment operators (`strenv`) inject CI secrets or build numbers safely without YAML type-coercion bugs turning `”0123″` into an octal integer.

Avoid the package name mix-up

Two different tools share the name `yq` across Linux package managers (Mike Farah’s standalone Go binary versus a Python wrapper around `jq`), so verify `yq –version` shows `mikefarah/yq` v4 before running in-place `-i` edits. Grab the static Go binary today to automate your YAML release bumps safely.

Ready to try yq?

Experience the full capabilities on their official website.

Visit Official Website