Consuming Web API JSON Data Using curl and jq
Hey everyone! I decided to put a few extra batteries in the background color of the article image above. 🙂 I’m actually pretty charged up about our topic today, particularly about jq, which is a lightweight and flexible command-line JSON processor with “batteries included”.
JSON has become the lingua franca for exchanging data on the web, and we (as developers) need to know how to process JSON data so we can be positioned for the present and for the future. Today, we’re zooming in and learning about consuming Web API JSON data from bash using curl and jq.
Prepare environment
We’ll be working in bash today so you will need to find a Linux machine to give this a go. I’m personally running on a Raspberry Pi (Raspbian), but this tutorial will work equally well in any Linux-based environment. (My instructions will, however, be geared toward Debian-based Linux distros since we will be using the apt command.) To set up a Raspberry Pi, you can follow the instructions in my popular Beginner’s Guide to Installing Node.js on a Raspberry Pi. We won’t need Node.js for this tutorial; however, my beginner’s guide will help you get an awesome development environment set up that optionally includes Node.js too. If you don’t have a Linux environment already, other options might include running Ubuntu on a virtual machine.
thisdavej.com