Jq

jq is a command line JSON processor, this works really well in tandem with HTTPie.

Usage

Get all elements from array response

jq '.[]'

Filter those elements on a key

# truthy test
jq '.[] | select(.mykey)'

# specific values
jq '.[] | select(.mykey === 'some value')'

Return only a specfic key from an array result

jq '.[].mykey'

Return a specific element's value based on a filter on a key in an array response

jq '.[] | select(.id == 123).mykey'

Content properties

  • Type: Note
  • Category: Software
  • Tags: backend, tooling
  • Custom slug: None

This is a preview of a simpler page design that I'm working on over the next little bit. I've finally added a (click it!) but there's still a few pages left to be converted so don't worry if things don't look quite right just yet 🙏

Content on blog pages use the CC-BY-SA license. The source code and notes use the MIT license. Unsure? Mention me on Mastodon.