Convert YAML to JSON yq
Output YAML document as JSON
yq -o=json '.' config.yaml
more yq
all 15 commands →
Convert JSON to YAML
cat config.json | yq -P '.'
Filter array items by condition
yq '.items[] | select(.status.phase == "Running")' pods.yaml
Update image tag across manifests
yq -i '(.spec.template.spec.containers[] | select(.name == "app") | .image) = "myapp:v2.0.0"' deployment.yaml
Process multiple files at once
yq '.metadata.name' manifests/*.yaml
Read YAML field
yq '.spec.replicas' deployment.yaml