Skip to content

Conversation

@joshrotenberg
Copy link
Collaborator

Summary

Replace piped jq commands with redisctl's built-in -q/--query flag and --raw option throughout documentation. This demonstrates redisctl's native query capabilities and reduces external dependencies.

Changes

57 files modified across all documentation sections:

  • Getting Started & Walkthroughs
  • Cloud documentation (databases, subscriptions, ACLs, networking)
  • Enterprise documentation (cluster, nodes, databases, monitoring)
  • Tutorials (monitoring, CI/CD, production databases)
  • Cookbook recipes
  • Reference guides (best practices, troubleshooting)
  • Presentation slides

Conversion Patterns

Before (jq) After (JMESPath)
` jq '.field'`
` jq -r '.[].id'`
` jq '.[]
` jq '{a: .a, b: .b}'`
` jq 'length'`

jq Retained For

Some jq usages were intentionally kept where JMESPath lacks equivalent features:

  • CSV formatting (@csv)
  • Complex aggregations (group_by, add)
  • Arithmetic operations (division, percentages)
  • String manipulation (split, string interpolation)
  • JSON schema validation

Closes #514

Replace piped jq commands with redisctl's built-in -q/--query flag
and --raw option throughout documentation. This demonstrates
redisctl's native query capabilities and reduces external dependencies.

Conversions include:
- Field extraction: | jq '.field' → -q 'field'
- Array iteration: | jq -r '.[]' → -q '[]' --raw
- Filtering: | jq '.[] | select(.x=="y")' → -q '[?x==`y`]'
- Projections: | jq '{a,b}' → -q '{a: a, b: b}'

jq is intentionally retained for:
- CSV output formatting (@csv)
- Complex aggregations (group_by, add)
- Arithmetic operations (division, percentages)
- String manipulation (split, interpolation)
- JSON schema validation

Closes #514
Leverage redisctl's extended JMESPath functions to convert additional
jq examples that require advanced features:

- group_by() for grouping arrays by field value
- divide()/multiply() for arithmetic operations
- sprintf() for formatted string output
- has() for key existence checks
- join() for array-to-string conversion

Remaining jq usage is limited to:
- @csv output formatting (no JMESPath equivalent)
- Pretty-printing raw JSON (jq .)
@joshrotenberg joshrotenberg merged commit a911615 into main Dec 17, 2025
14 checks passed
@joshrotenberg joshrotenberg deleted the docs/jq-to-jmespath branch December 17, 2025 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: Convert jq examples to JMESPath queries

2 participants