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
| Name | Type | Description |
|---|---|---|
| -r | option | raw strings |
| -e | option | result-sensitive status |
| FILTER | operand | jq program |
| FILE | operand | JSON 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