yq

Command-line YAML/JSON/XML processor (like jq but for YAML).

low risk

interactive breakdown — edit the command and press Explain
$ 
⚠ Risks & cautions
What it does

yq processes YAML, JSON, XML, and TOML files with a jq-compatible syntax. Invaluable for editing Kubernetes manifests, Helm values files, and CI config files without breaking structure. The -i flag edits files in-place.

Common flags
FlagMeaning
-i --inplaceEdit file in-place
-r --rawOutput raw strings
-o --output-formatOutput format: yaml, json, props
Examples
yq '.spec.replicas' deployment.yamlRead replica count from a manifest · explain & risk-check →
yq -i '.spec.replicas = 3' deployment.yamlUpdate replica count in-place · explain & risk-check →
yq -o json deployment.yaml | jq '.spec'Convert YAML to JSON for jq processing · explain & risk-check →
yq eval-all '. as $item ireduce ({}; . * $item)' base.yaml override.yamlDeep merge two YAML files · explain & risk-check →
Pro tip

Use yq to patch image tags in manifests during CI: `yq -i '.spec.template.spec.containers[0].image = "app:v1.2.3"' deploy.yaml` — cleaner than sed on YAML.

Related
jq kubectl helm
Open the full explainer →More in Text Processing

Reference text is hand-written and may be incomplete — check man yq for your version. Test destructive commands on a non-production system first.