jq is a command-line tool for working with JSON. Its own documentation describes it as “a lightweight and flexible command-line JSON processor” and draws the analogy directly: jq is “like sed for JSON data,” letting you “slice and filter and map and transform structured data with the same ease that sed, awk, grep and friends let you play with text.” The project was created by Stephen Dolan and first released in 2012, filling a gap that the classic Unix text tools could not: those tools treat input as flat lines of bytes, while JSON is nested and structured, so cutting a field out with awk or grep is brittle. jq understands JSON’s grammar natively.
The heart of jq is its query language, which is functional and stream-oriented. A jq program is an expression, called a filter, that takes JSON in and produces JSON out. The simplest filter, ., passes its input through unchanged, which is the common way to pretty-print a blob of JSON. From there filters compose with the pipe operator inside jq itself: .user.name reaches into nested objects, .items[] iterates over an array, and .items[] | .price streams each element through a further filter. The syntax deliberately echoes both shell pipelines and object access, so it reads naturally to anyone who already lives at the command line.
Because filters are values that combine, jq scales from trivial extraction to real data transformation. It has built-in functions for mapping (map), selecting (select), counting (length), and reshaping objects, along with arithmetic, string operations, and conditionals. A single expression like .[] | select(.active) | {name, id} filters a list to active records and rebuilds each as a smaller object. This is the same pattern-then-act, transform-and-emit model that made AWK powerful, carried into the world of structured data.
jq earned its place because of where JSON ended up: it became the lingua franca of web APIs and configuration, so command-line work increasingly meant piping JSON between programs. jq slots into exactly that pipeline. A curl call fetching an API response feeds straight into jq, which extracts the fields you want and hands clean text or JSON to the next stage. It keeps the Unix discipline of small programs joined by streams while finally giving those streams a JSON-aware filter.
The implementation reflects its niche too. jq is a single self-contained program written in C with no runtime dependencies, easy to drop onto any machine. After a quiet period the project was revived in 2023 under the jqlang GitHub organization with new maintainers, but the language and its design remain Dolan’s. The authoritative references are the jq manual at jqlang.org and the source repository at github.com/jqlang/jq.