explaingit

jqlang/jq

📈 Trending34,747CAudience · developerComplexity · 2/5ActiveLicenseSetup · easy

TLDR

Command-line tool for querying and transforming JSON data using a compact filter language, like grep and sed for JSON.

Mindmap

mindmap
  root((jq))
    What it does
      Query JSON data
      Transform JSON
      Extract fields
      Reshape data
    How it works
      Filter language
      Unix pipelines
      Standard input/output
    Use cases
      API debugging
      Log processing
      Data extraction
      Config manipulation
    Tech stack
      C language
      No dependencies
      Single executable
    Audience
      DevOps engineers
      Backend developers
      Data analysts

Things people build with this

USE CASE 1

Extract specific fields from API responses piped through curl without writing a script.

USE CASE 2

Filter and reshape JSON log files to find errors or specific events in deployment logs.

USE CASE 3

Transform configuration files or package metadata to extract version numbers or dependencies.

USE CASE 4

Combine with shell pipelines to process JSON data alongside grep, sort, and other Unix tools.

Tech stack

CUnix/LinuxmacOSWindows

Getting it running

Difficulty · easy Time to first run · 5min
Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

jq is a command-line tool for processing and transforming JSON data, in much the same way that tools like grep and sed let you process plain text on the command line. The problem it solves is that JSON has become the universal format for data exchange, API responses, configuration files, log outputs, but it is not designed to be readable or filterable with basic text tools. jq gives you a compact, expressive way to query, reshape, and extract information from JSON without writing a full program. The tool works through a filter language where you write an expression that describes the transformation you want applied to the input JSON. The simplest filters extract fields by name: the expression .version applied to a package.json file returns just the value of the version field. More complex filters can slice arrays, iterate over lists, apply conditional logic, restructure data into entirely new shapes, compute values, and combine multiple transformations in a pipeline. Because jq reads from standard input and writes to standard output, it fits naturally into Unix shell pipelines alongside curl, grep, sort, and other tools. A typical real-world use: you call an API with curl, pipe the raw JSON response into jq with a filter that extracts a specific list of values, and then pipe those values into another tool. What would otherwise require a short Python script becomes a single readable command line. jq is written in C with no runtime dependencies, so it ships as a single small executable available on macOS, Linux, and Windows through most package managers. You would reach for it any time you are working with JSON data in a shell, debugging an API, exploring a data file, writing a deployment script, or processing log output, and want to do it quickly without leaving the terminal.

Copy-paste prompts

Prompt 1
Show me how to use jq to extract the 'version' field from a package.json file and pipe it to another command.
Prompt 2
Write a jq filter that takes an array of objects and extracts just the 'name' and 'email' fields from each one.
Prompt 3
How do I use jq to filter a JSON array to only include items where a specific field matches a value?
Prompt 4
Give me a jq one-liner that transforms a nested JSON object into a flat list of key-value pairs.
Prompt 5
Show me how to pipe a curl API response into jq to extract and count items in a nested array.
Open on GitHub → Explain another repo

Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.