JSON wrangling with jq
Help 3 / 10
Filter data

Select Arrays

If you curl the GitHub Issues API, you will get back an array of issues:

curl "https://api.github.com/repos/stedolan/jq/issues?per_page=5" > issues.json; cat issues.json

To get a specific element in the array, give jq an index:

jq '.[4]' issues.json

You can use the array index with the object index:

jq '.[4].title' issues.json

And you can use [] to get all the elements in the array. For example, here is how I would get the titles of the issues returned by my API request:

jq '.[].title' issues.json
Loading...