CodeFaster

CodeFaster

Share this post

CodeFaster
CodeFaster
Mastering JQ: Part 1

Mastering JQ: Part 1

Tyler Adams's avatar
Tyler Adams
Jun 30, 2020
∙ Paid
8

Share this post

CodeFaster
CodeFaster
Mastering JQ: Part 1
8
Share

This is the first part of an ongoing series on mastering jq. This series does not assume prior experience with jq, but it does assume basic fluency in shell programming.

jq is a valuable tool that every fast coder has in their tool chest. It contains depths of immense power. In part 1, we'll start off with the basics.

For each application of jq, we’ll lead off with an example that you can copy and paste into your shell to see how it works. The rest of the section discusses the application in more detail.

Pretty print json

echo '{"k1": [{"k2": [9]}]}' | jq '.'

One of the most valuable applications of jq is also the easiest to use: pretty printing json.

Pass the desired json on stdin to jq and it will print pretty print json on stdout. jq's pretty printing adds both shape and color to the data. Shape and color make the data much faster to read and debug as discussed in Debug With Your Eyeballs. One caveat is that jq will not render colors if jq's output is piped into another command or a fil…

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2025 Tyler Adams
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share