jq

I rediscovered jq the other day, a little command line tool to format, read, and transform JSON from the command line.

Jq falls into one of my favorite categories of tools: the "simple and do one thing good" category—the Unix philosophy at its finest.

Pipe any JSON to jq. The first thing you'll notice is the added syntax highlighting.

A curl request to the GitHub API

A curl request to the GitHub API piped through jq

Then, you can use a path syntax to query the JSON object.

Filtering a JSON object with jq's path syntax

The path syntax supports arrays and deeply nested objects, and can even map data with a pipe operator.

Transforming a JSON object with jq's path syntax

Installing jq on a Mac is as easy as brew install jq. Read the docs for further instructions and a detailed explanation of the path syntax.