name: data-processing
Query, filter, and transform structured data (JSON, YAML, TOML) efficiently from the command line.
| Tool | Command | Use For |
|---|---|---|
| jq | jq '.key' file.json |
JSON processing |
| yq | yq '.key' file.yaml |
YAML/TOML processing |
# Extract single field
jq '.name' package.json
# Extract nested field
jq '.dependencies | keys' package.json
# Filter array
jq '.users[] | select(.active == true)' data.json
# Transform structure
jq '.items[] | {id, name}' data.json
# Pretty print
jq '.' response.json
# Compact output
jq -c '.results[]' data.json
# Extract field from YAML
yq '.services | keys' docker-compose.yml
# Get all container images
yq '.services[].image' docker-compose.yml
# Extract GitHub Actions job names
yq '.jobs | keys' .github/workflows/ci.yml
# Get K8s resource names
yq '.metadata.name' deployment.yaml
# Convert YAML to JSON
yq -o json '.' config.yaml