Alexander Bird Software • Blog

Learning to build useful, valuable software as part of a team.

jq cheat sheet

Notes on cool things to do with the JSON processor tool

(Link to official jq docs)

Making .jq files executable

  $ echo '"World"' | ./greeting.jq
    "hello": "World"
  $ cat greeting.jq
  #!/usr/bin/env jq -f
    hello: .

Table Formatting

Unix column formats tab separated output as a table and jq @tsv produces tab separated output.

  curl \
    | jq -r ".[] | [.id,, .name] | @tsv" \
    | column -ts $'\t'

Vim syntax highlighting

GitHub: vito-c/jq.vim

Written 2020-12