| name | jq |
| description | Writes jq filters to query, reshape, aggregate, and pipeline JSON from APIs, CLIs, and logs. Use when parsing JSON, building jq one-liners, or explaining a jq expression. Not for in-memory DataFrames (pandas/polars), JSON Schema validation, or JavaScript Array.map as a jq substitute. |
| version | 1.0.1 |
| category | development |
| risk | safe |
| source | community |
| date_added | 2026-03-28 |
| tags | ["jq","json","shell","cli","data-transformation","bash"] |
| tools | ["claude","cursor","gemini"] |
jq — JSON Querying and Transformation
Overview
jq is the standard CLI tool for querying and reshaping JSON. This skill covers practical, expert-level usage: filtering deeply nested data, transforming structures, aggregating values, and composing jq into shell pipelines. Every example is copy-paste ready for real workflows.
When to Use
- Parsing JSON output from APIs, CLI tools (AWS, GitHub, kubectl, docker), or log files
- Transforming JSON structure (rename keys, flatten arrays, group records)
- Building
jq one-liners inside a bash script or PowerShell pipeline
- Explaining what a complex
jq expression does
- Extracting specific fields from large JSON payloads for further processing
Prerequisites
jq installed and on PATH. Verify with jq --version (requires ≥ 1.6 for walk, --stream stability).
- On Windows (PowerShell, primary host): install via
winget install jqlang.jq or scoop install jq. The binary is jq.exe; all filter syntax is identical across platforms.
- On Linux/macOS:
brew install jq or apt-get install jq.
- Familiarity with JSON data types (object, array, string, number, boolean, null).
Procedure
1. Basic Selection
echo '{"name":"alice","age":30}' | jq '.name'
echo '{"user":{"email":"a@b.com"}}' | jq '.user.email'
echo '[10, 20, 30]' | jq '.[1]'
echo '[1,2,3,4,5]' | jq '.[2:4]'
| jq