Text and processing

The jq command

Processes and formats JSON from the terminal: extracts fields, filters and shows API data readably.

Syntax

jq 'filtro' archivo.json

Most useful options

.Shows the whole JSON formatted
.campoExtracts a field
.[0]First element of an array

Copy-ready examples

$ printf '{"a":1}\n' > d.json && jq .a d.jsonExtract field a

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • If the JSON is malformed, jq errors out; check it first with cat.

Related commands

FAQ

What is jq for in daily use?

To read API responses or config files without getting lost among braces.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course