Alberto A. Flores

Alberto A. Flores

Sr. Software Engineer

© 2022

Dark Mode

JSON on BASH: JQ

In one of my previous posts, I wrote about underscore-cli for looking at JSON output (e.g. to see the curl response from a REST web service). An alternative to this is jq, a command line processor for JSON. This CLI allows for simple, yet powerful expressions that make any CLI pro user be productive when interacting with REST services.

Some things about jq that make it powerful is that it can be used as a filter (that’s what jq really is). This means that you can select which parts of the JSON buffer be returned from the stream so that you can you do your own navigation. Think of SQL for JSON. You can also construct powerful expressions in BASH for parsing JSON without needing python or ruby.

In general jq is very simple to install and use, with great documentation. For more information, check out https://stedolan.github.io/jq/tutorial/