PHPnews.io

jq

Written by Sebastian De Deyne / Original link on Jan. 4, 2021

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.

jq-before.jpg

jq-highlight.jpg

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

jq-path.jpg

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

jq-pipe.jpg

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.

sebastiandedeyne

« Update from the Diversity Initiative - Consistency »