commands

jq — query JSON

Parses JSON and applies a filter. -r outputs raw strings. -e changes exit semantics according to last result (false/null, no result); parse and compile errors are distinct. Separate package. Does not change input files by default. Example assumes a fresh search-transform lab fixture.

Formal Syntax & Structure

linux syntaxlinux
jq [OPTION]... FILTER [FILE]...

Parameters & Attributes

NameTypeDescription
-roptionraw strings
-eoptionresult-sensitive status
FILTERoperandjq program
FILEoperandJSON input

Return Value

exit status and output

Parses JSON and applies a filter. -r outputs raw strings. -e changes exit semantics according to last result (false/null, no result); parse and compile errors are distinct. Separate package. Does not change input files by default.

Working Example

Example Snippetlinux
jq '[.items[].qty] | add' inventory.json
Linux Reference