Developer bit

Use jq to query and manipulate JSON data

jq is a lightweight command-line tool to quickly process your JSON data. I mainly use it to search ( grep ) and select specific fields of a JSON file, but it...

Use jq to query and manipulate JSON data

jq is a lightweight command-line tool to quickly process your JSON data. I mainly use it to search (grep) and select specific fields of a JSON file, but it can also be used to transform (sed) and process (awk) the data. Of course, the output is also nicely formatted.

If this peaks your interest head over to the download page.

data.json
{
"persons": [
{
"id": 1,
"name": "Bob"
},
{
"id": 2,
"name": "Alice"
}
],
"lastModified": "2023-11-26"
}

While these examples are simple and are using a local data source, you can feed data to jq using the pipe (|) operator.

curl 'https://api.github.com/repos/jqlang/jq/commits?per_page=5' | jq '.'

Make sure to check out the tutorial and the playground to also learn how to fully take advantage of jq by transforming and filtering JSON data.

Feel free to update this developer bit on GitHub, thanks in advance!

Enjoying the blog?

Support my work

If you enjoyed this post and found it useful, consider supporting my work. It helps me keep creating and sharing content like this. Thank you!