Skip to content

Instantly share code, notes, and snippets.

@jdmichaud
Created January 16, 2018 08:14
Show Gist options
  • Select an option

  • Save jdmichaud/eb53122ebded9173c94bbd2d97cfd8e3 to your computer and use it in GitHub Desktop.

Select an option

Save jdmichaud/eb53122ebded9173c94bbd2d97cfd8e3 to your computer and use it in GitHub Desktop.
Some jq examples
$ cat somefile
{
  "field": {
    "entry1": 12,
    "entry2": 42,
    "entry3": 8,
  }
}

Retrieve keys of an object and return them as an array:

$ <somefile jq '.field | to_entries[] | .key'
"entry1"
"entry2"
"entry3"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment