← Back to archive

Repo of the Day

jqlang/jq

Published: Sep 27, 2021

Open repository ↗

Useful tutorials and resources

Summary

jq is a command-line JSON processor written in portable C with no runtime dependencies. It slices, filters, maps, and transforms structured JSON data, and is described in its README as a JSON counterpart to sed, awk, and grep.

What it is useful for

Engineers reach for jq when they need to extract or reshape JSON inside shell pipelines. Typical jobs include pulling specific fields from API responses, flattening nested structures, filtering arrays, and reformatting output for downstream tools. The README positions it as a JSON analog to sed, awk, and grep, which matches how it tends to slot into day-to-day scripting, CI jobs, and lightweight containers. Because the prebuilt binaries ship without extra libraries, the same tool works in a developer's terminal, a build script, or a minimal image.

How engineers can use it

The README documents three installation paths. The fastest is to download a prebuilt binary from the GitHub releases page; on macOS and Linux the asset is a single standalone file that the reader renames to jq and makes executable with chmod +x jq.

For containerized workflows, the README shows two Docker examples that read package.json and print the version field. One streams the file into the container over stdin, and the other mounts the current working directory so jq can read the file by path:

docker run --rm -i ghcr.io/jqlang/jq:latest < package.json '.version'
docker run --rm -i -v "$PWD:$PWD" -w "$PWD" ghcr.io/jqlang/jq:latest '.version' package.json

For local builds, the README lists the required tools (libtool, make, automake, autoconf) and the standard configure/make sequence, including a git submodule update --init step to fetch oniguruma and a make LDFLAGS=-all-static target for a static binary. A caveat in the README: when building from a release tarball rather than a git checkout, the autoreconf step is not needed, and flex and bison are not required.

Full language documentation lives at jqlang.org, and play.jqlang.org offers a browser playground for experimenting without installing anything. The README states the project is released under the MIT License, but the repository's GitHub metadata records the license as NOASSERTION, so anyone redistributing or vendoring jq should verify the terms directly from the project's COPYING file.