Skip to main content

jq Cheats

Cheat sheet for jq commands.

info

This page was automatically generated from a navi cheat file available at difranca/navi-cheats.
Navi is an interactive cheatsheet tool for the command-line. To learn more about it, visit denisidoro/navi.


Basicsโ€‹

Select and extract data from JSON.

CommandDescription
**jq '.'**
**jq '.{field}'**
**jq '.{field}.{nested_field}'**
**jq '.[0]'**
**jq '.[].{field}'**
**jq '.

Filter & Selectโ€‹

Filter and search JSON data.

CommandDescription
**jq '.[]
**jq '.[]
**jq '.[]
**jq '[.[].{field}]
**jq 'sort_by(.{field})'**

Transformโ€‹

Reshape and transform JSON.

CommandDescription
**jq '.[]
**jq '[.[]
**jq 'flatten'**
**jq 'group_by(.{field})'**
**jq '.[]
**jq -r '.[]
**jq '.[] + {"{new_key}": "{value}"}'**

Outputโ€‹

Control output format.

CommandDescription
**jq -r '.{field}'**
**jq -c '.'**
**jq -r '.[]
**jq '[.[]