- 1 Another 3 AM Slack Alert—Thanks, JSON
- 2 Stop Using Grep on JSON—It’s Like Using a Hammer on Screws
- 3 My “jq in the Wild” Story
- 4 The 60-Second jq Cheat-Sheet
- 5 Real Workflows That Save Hours
- 6 Install & Dance: 30 Seconds to Setup
- 7 A Quick Example You Can Try Right Now
- 8 From Zero to Hero—A Week of Tiny Wins
- 9 Need a Sandbox?
Another 3 AM Slack Alert—Thanks, JSON
It’s Tuesday evening. Your phone buzzes.
CRITICAL: prod-api-7c6d7c8f88-dkr9z → pod health check failed Details: parse error in response.json Line: 18,873, Column: 42
You open the response in Postman.
Seventeen kilo-lines of curly braces.
All you need is one field—`status.healthy`—buried so deep it could run for Congress.
Sound familiar? Then read on.
—
Stop Using Grep on JSON—It’s Like Using a Hammer on Screws
Most of us start with this:
curl https://api.prod.local/health | grep healthy
Fun… until the word “healthy” shows up in someone’s chat message inside the same blob.
The real fix? A tiny command-line tool that actually *understands* JSON structure.
It’s called jq. Two-letter install. Ten-minute learning curve. Endless payoff.
—
My “jq in the Wild” Story
Last quarter our Terraform state file was **400 MB**. Every plan took three minutes to download before we could even read it. Morale: low.
I spent one lunch break wrapping it with `jq`:
terragrunt show -json | jq '.values.root_module.resources[] |
select(.type=="aws_instance" and .values.tags["Environment"]=="prod") |
{id: .values.id, state: .values.instance_state}'
Reduced the print-out to **17 clean lines**. HR asked what I was smiling about.
—
The 60-Second jq Cheat-Sheet
Memorize four patterns and you’re faster than most senior engineers.
- Pick a field
jq '.field' - Drill into arrays
jq '.items[]' - Filter
jq '.items[] | select(.ready==true)' - Rename output
jq '{new: .old.deep.name}'
Copy-paste into your shell. Done.
—
Real Workflows That Save Hours
1. Monitor Kubernetes Without Kubectl Spam
kubectl get pods -o json | \
jq -r '.items[] | "\(.metadata.name) \(.status.phase)"' | \
grep -v Running
Run every 30 seconds. Clean table in the terminal.
2. Cherry-Pick GitHub Issues for Stand-Up
curl -s https://api.github.com/repos/your-org/repo/pulls?state=open | \
jq '.[] | {title, user: .user.login, commits: .commits}'
Beam the list to Slack in one line.
3. Assert API Responses in CI
curl -s https://api.prod.local/health | jq -e '.healthy==true' >/dev/null \
|| echo "Health check FAILED" >&2; exit 1
Zero dependencies. Works on any runner.
—
Install & Dance: 30 Seconds to Setup
Most recent Linux distros include it.
# Debian/Ubuntu
sudo apt install jq
# macOS
brew install jq
# Verify
jq --version # you should see 1.7 or newer
Now open the ugliest JSON file within reach and run:
cat messy.json | jq .
Magical indentation. You’re in.
—
A Quick Example You Can Try Right Now
Open your terminal and paste the mini-newsletter at the bottom of https://api.github.com/users/octocat
curl -s https://api.github.com/users/octocat | jq '{name, repos: .public_repos, joined: .created_at}'
Output:
{
"name": "The Octocat",
"repos": 8,
"joined": "2011-01-25T18:44:36Z"
}
Try doing that with sed.
—
From Zero to Hero—A Week of Tiny Wins
- Day 1: Extract your first nested field. Smile at the console.
- Day 2: Replace a brittle Python helper in CI with four lines of shell.
- Day 3: Build an alert script. Watch on-call volume drop.
- Day 4: Drop a jq recipe into the chat. Become the MVP of stand-up.
- Day 5: Teach a teammate. Lock the knowledge in.
By next month JSON stops causing fear. It feels like data, not lava.
—
Need a Sandbox?
https://jqplay.org lets you paste any JSON on the left, type `jq` on the right, and see results instantly. No installs, no excuses.
Try it with that failing health check from 3 AM. The one haunting you.
—
Take it from a guy who once wondered why YAML was “so much easier.” JSON never stopped being hard. We just got better tools.
Install jq now.
Thank me at 2:17 AM—when the alert pops up and you fix it in thirty seconds flat.







