Using and jq together is the industry standard for interacting with REST APIs via the command line. While curl retrieves the raw data, jq acts as a powerful processor to filter and format the often-messy JSON output. How to Download and Install jq Using curl
If you are on a system where you cannot use a standard package manager (like apt or brew ), you can download the prebuilt binary directly using curl . 1. Download the Binary Use the following commands based on your operating system: curl -L -o jq https://github.com Use code with caution. macOS (Intel): curl download jq
On Linux and macOS, you must grant execution permissions and move it to a directory in your $PATH (like /usr/local/bin ) to run it from anywhere. chmod +x jq sudo mv jq /usr/local/bin/ Use code with caution. Verify the installation by running jq --version . Using curl and jq Together (Common Use Cases) Using and jq together is the industry standard
Once installed, the most common pattern is "piping" the output of a curl request directly into jq . Beautify JSON Output chmod +x jq sudo mv jq /usr/local/bin/ Use code with caution
curl -L -o jq https://github.com/stedolan/jq/releases/latest/download/jq-osx-amd64 Use code with caution. curl -L -o jq.exe https://github.com Use code with caution. 2. Make it Executable & Move to Path
Standard API responses are often minified and hard to read. Use a simple dot . to "prettify" the output. Download jq