Install Dasel on Raspberry Pi

Install Dasel on Raspberry Pi

Dasel is a command line tool to select and modify data being presented in different formats. This tool supports JSON, TOML, YAML, XML and CSV data formats. Dasel can convert between formats.

This tutorial shows how to install Dasel on Raspberry Pi.

Install Dasel

Connect to Raspberry Pi via SSH and download executable file from releases page of the Dasel repository.

sudo wget -qO /usr/local/bin/dasel https://github.com/TomWright/dasel/releases/latest/download/dasel_linux_arm32

Next, set execute permission:

sudo chmod a+x /usr/local/bin/dasel

We can check Dasel version as follows:

dasel --version

Testing Dasel

Create a test.json file:

echo '{"status":"success","data":[{"name":"John","age":25},{"name":"James","age":29}]}' > test.json

Dasel use the same selector syntax no matter the data format. Each different part in selector is separated by a dot (.). For example, the following command selects all elements and prints nicely formatted JSON:

dasel -s '.' -f test.json

You will get the following output:

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

Specific field can be selected as follows:

dasel -s '.data.[1].name' -f test.json

Output:

"James"

One data format can be converted to another. For example, the following command converts JSON to YAML:

dasel -f test.json -w yaml > test.yaml

Uninstall Dasel

If you wish to completely remove Dasel, delete executable file:

sudo rm -rf /usr/local/bin/dasel

Leave a Comment

Cancel reply

Your email address will not be published.