jq 🧹

JSON formatter/prettifier.

🏠 https://stedolan.github.io/jq/
📗 https://github.com/stedolan/jq

Installation (on Debian)

sudo apt-get install jq

Format/prettify

echo -n '{"who":["me","you"],"when":"now"}' | jq
{
  "who": [
    "me",
    "you"
  ],
  "when": "now"
}

Indentation with tab --tab

echo -n '{"who":["me","you"],"when":"now"}' | jq --tab

Compact -c

cat << EOF | jq -c
{
  "who": [
    "me",
    "you"
  ],
  "when": "now"
}
EOF
{"who":["me","you"],"when":"now"}

Sort keys -S

echo -n '{"z":"z","a":"a"}' | jq -S
{
  "a": "a",
  "z": "z"
}

Uncolorize output (monochrome) -M

echo -n '{"who":"me","when":"now"}' | jq -M

About Living in the Shell
Obsessed with doing things in the shell, I’ve decided to share my daily struggles on living in the shell as terse but informative posts.