Install jql on Ubuntu 24.04

Install jql on Ubuntu 24.04

The jql is a JSON query language tool via command line. It provides a means to extract, manipulate, and interact with JSON data efficiently. This tutorial explains how to install jql on Ubuntu 24.04.

Install jql

Get the latest version of jql straight from its GitHub repository:

JQL_VERSION=$(curl -s "https://api.github.com/repos/yamafaktory/jql/releases/latest" | grep -Po '"tag_name": "jql-v\K[0-9.]+')

Download jql with the determined version:

wget -qO jql.tar.gz https://github.com/yamafaktory/jql/releases/latest/download/jql-v$JQL_VERSION-x86_64-unknown-linux-musl.tar.gz

Extract the executable to the /usr/local/bin directory:

sudo tar xf jql.tar.gz -C /usr/local/bin jql

Run the command to verify the jql version:

jql --version

Remove the unnecessary file:

sudo rm -rf jql.tar.gz

Testing jql

Assume there is JSON data stored in the test.json file:

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

For instance, extracting a specific field from a JSON object or an element from a JSON array can be done as follows:

jql '"data"[1]"name"' test.json

Uninstall jql

To uninstall jql, just delete the file it's associated with:

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

Leave a Comment

Cancel reply

Your email address will not be published.