Cheatsheet: JQ
Last updated 2026-02-08
Basic operations
Identity operator (.)
Object identifier/index
Generic object index
Array operations
Array index
Array/string slice
Array length
Object construction
Select fields without renaming
Select fields with renaming
Concatenate fields
Value as field name
Filtering and transforms
Flatten nested arrays
Merge multiple objects with slurp
map/to_entries/from_entries/with_entries
to_entries - object to array of key/value pairs
CLI and safety patterns
Raw output (no JSON quotes)
Fallback/default value
Optional chaining style access
Pass a string argument
Pass a JSON argument
if/else and helper functions
if/else
if/elif/else
Helper functions
See also: