Install jq on Raspberry Pi

JSON is a text-based data format that is widely used to store or exchange data between systems. The jq is a command line based JSON processor that allows to transform, filter, slice, map, or perform other operations on JSON data.

This tutorial shows how to install jq on Raspberry Pi.

Connect to Raspberry Pi via SSH. Update the package lists and install jq using the following commands:

sudo apt update
sudo apt install -y jq

Once installed, check jq version:

jq --version

Now we can test. Let’s say we have JSON data stored in the test.json file:


The jq tool supports various filters that can be applied on JSON data. For example, the dot . filter prints unchanged but nicely formatted JSON.

jq '.' test.json

Command will output:

  "status": "success",
  "data": [
      "name": "John",
      "age": 25
      "name": "James",
      "age": 29

We can get a particular field of JSON object or an element of JSON array:

jq '.data[1].name' test.json



If you want to completely remove jq and related dependencies that is not used by other packages, execute the following command:

sudo apt purge --autoremove -y jq

This article has 1 comment

  1. SPS_Hubert Reply

    I used this with Tasmota devices.
    curl -s | jq -r .StatusSNS.ENERGY.Power

    Thank you,

Leave a Comment

Your email address will not be published. Required fields are marked *