Installation

Linux

Snap

Using snap

sudo snap install yq

Windows

Winget

Using winget

winget install --id MikeFarah.yq
winget upgrade --id MikeFarah.yq

Usage

# Convert JSON to YAML
# https://stackoverflow.com/a/77088493
yq -p json -o yaml swagger.json > openapi.yaml
# Get unique tags from markdown files
find \
-name "*.md" \
-exec yq \
--front-matter extract \
'.tags // [~]' {} \; > temp.yaml
 
yq 'unique | sort' temp.yaml

Appendix