jq

Parse, filter, and transform JSON data with jq pipelines.

40|12|Updated Oct 17, 2011
One-click install
npx skills add https://github.com/lanej/dotfiles --skill jq
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: jq
Source: https://github.com/lanej/dotfiles/tree/main/claude/skills/jq
Command: npx skills add https://github.com/lanej/dotfiles --skill jq

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires jq-cli.

What problem does it solve?

This Skill eliminates the need for cumbersome scripting or complex regex to process JSON data. It provides jq, a lightweight and powerful command-line JSON processor, allowing you to quickly filter, transform, and analyze JSON with simple, composable commands.

Core Features & Use Cases

  • JSON Formatting & Selection: Pretty-print JSON, select specific fields (nested or array elements), and create new objects from existing data.
  • Array Operations & Aggregations: Map, filter, sort, group, and aggregate values (sum, average, min/max) within JSON arrays.
  • Data Transformation: Add, update, rename, or delete fields, and apply conditional logic to modify JSON structures.
  • Use Case: Take a complex JSON API response containing an array of user objects. Use jq to extract only the id, name, and email fields from active users, and output the result as a clean, readable JSON array, ready for further processing.

Quick Start

Pretty-print the contents of 'data.json' and then extract the 'user.email' field.

Frequently Asked Questions about jq

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I filter and extract specific fields from JSON data?

Use jq to filter JSON by selecting nested fields with dot notation (e.g., `.user.email`) or array indices. jq outputs only the data you specify, making it ideal for extracting relevant fields from API responses or configuration files without writing custom scripts.

Can I transform and restructure JSON objects with jq?

Yes. jq lets you add, rename, delete, or reorganize fields using expressions like `{id, name, email}` to build new objects, or `map()` to transform array elements. You can apply conditional logic and compose multiple operations into readable pipelines.

How do I aggregate and analyze data within JSON arrays?

jq provides built-in functions to map, filter, sort, and aggregate array values—sum, average, min, max, group operations. Chain these functions to perform analytics on JSON data without loading it into separate tools.

What's the best way to format and pretty-print JSON from the command line?

jq pretty-prints JSON by default, making it readable. Use the `-c` flag for compact output or `-r` for raw strings. It handles malformed or minified JSON and lets you apply transformations while formatting.

Can I use jq in pipelines for batch processing and streaming data?

Yes. jq is memory-efficient and processes data as streams, making it ideal for pipelines. Pipe JSON from APIs, logs, or files through jq filters to transform or select data in real time without loading entire datasets into memory.

Do I need to learn a programming language to process JSON with jq?

No. jq uses a composable filter syntax designed for JSON manipulation—simpler than scripting languages. Start with basic selections and build up to complex transformations using straightforward, chainable commands.