yq

CLI>=4.0

A lightweight YAML, JSON, and XML processor.

6 views
text-processing#yaml#json#xml#query

Installation

Homebrewbrew install yq

Links

License

MIT

AI Agent Notes

Query and edit YAML/JSON/XML files like jq for YAML

When to use

Editing Kubernetes manifests, CI config, or any YAML files

Examples
  • yq '.spec.replicas' deploy.yaml
  • yq -i '.version = "2.0"' config.yaml

Proven Recipes

Read a YAML value🟢 98% success
yq '.spec.replicas' deploy.yaml
Edit YAML in-place🟢 95% success
yq -i '.version = "2.0"' config.yaml
⚠ Common failures (1)
  • File becomes emptyBackup first; yq -i only works with mikefarah/yq not Python yq
Convert YAML to JSON🟢 97% success
yq -o json config.yaml