Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active April 2, 2023 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dacr/1c9b53be1d40c5a6bf415ea0eafdc99c to your computer and use it in GitHub Desktop.
Save dacr/1c9b53be1d40c5a6bf415ea0eafdc99c to your computer and use it in GitHub Desktop.
jq cheat sheet / published by https://github.com/dacr/code-examples-manager #f3343d02-5885-4a13-8800-c01754abd0d0/a4922b69cf0d031fe0662f8eb13c670f3e6988b4

jq cheat sheet

extract some fields of objects contained in an array

echo '[{"a":1,"b":2,"c":3},{"a":10,"b":20,"c":30}]' | jq '.[] | .a, .b'

Notes:

  • use -r to get raw results without quotes for example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment