Skip to content

Latest commit

 

History

History
15 lines (12 loc) · 1.01 KB

jq.md

File metadata and controls

15 lines (12 loc) · 1.01 KB

Examples

  • jq -r '.[][][] | select(.field[2] == 4 and .field[1] == 43) | .field[4]' = If field[2] equals 4 and field[1] equals 43, then print field[4]. Don't include formatting quotes (-r).
  • i3-msg -t get_workspaces | jq '.[] | select(.focused == true) | .id' = Print the id field if the focused field equals true. NOTE: The value of the field may need to be quoted.
  • i3-msg -t get_outputs | jq '.[] | .name,.active' = Print both the name and active fields.
  • i3-msg -t get_outputs | jq '.[] | {name,active}' = Print both the name and active fields as dictionaries.