DEV Community

Mainak Bhattacharjee
Mainak Bhattacharjee

Posted on

Introducing rjq: A Fast and Lightweight CLI JSON Filtering Tool

In the world of data manipulation, JSON has become a ubiquitous format, but filtering and querying JSON data can be cumbersome without the right tools. Enter rjq, a command-line JSON filtering tool developed in Rust🦀, designed to be a performant and lightweight alternative to the popular jq tool.

The Motivation Behind rjq

rjq began as a hobby project, driven by a desire to create a tool that prioritizes performance and simplicity. With a keen focus on providing a robust alternative to jq, rjq is compatible with both Linux and Windows, making it accessible to a wider audience.
Key Features

Performance:

rjq has been optimized for speed, running nearly 2x faster than jq when tested on a Linux machine with 4GB RAM and an Intel i3 6th Gen processor. This performance boost can significantly enhance workflows, especially for users dealing with large datasets.

rjq vs jq benchmark

Simplicity:

The query structure of rjq is designed to be intuitive. Writing queries feels akin to crafting simple conditional statements in any programming language, which lowers the barrier to entry for new users.

Lightweight:

With a minimalistic approach, rjq ensures that users can quickly load and filter JSON data without unnecessary overhead.

How to Use rjq

Using rjq is straightforward. You can load JSON data from a file using the --load flag, or you can pipe input directly into the tool. Here are some usage examples:


rjq --load="test.json" --query="<query string>" --params="<comma separated parameter list>"
Enter fullscreen mode Exit fullscreen mode

Alternatively, you can pipe JSON output from other commands:


stto --json cpython | rjq --query="<query string>" --params="<comma separated parameter list>"
Enter fullscreen mode Exit fullscreen mode

The Development Journey

The development of rjq has been a valuable learning experience, particularly in mastering the intricacies of Rust. The support from the Reddit community was instrumental in overcoming challenges. You can check out some of the discussions and insights from fellow developers in this Reddit post.

Future Plans

Looking ahead, the goal for rjq is to become the go-to choice for JSON filtering on both Linux and Windows. rjq is still in early development stages and there are plans to incorporate new features and enhance the tool's capabilities to meet the needs of users day-to-day usage. Any contribution, stars ⭐ and fork 🔗 to the rjq repo is greatly appreciated 👍.

Who Can Benefit from rjq?

rjq is tailored for:

Developers:

Those working with JSON data who need a reliable filtering tool.

Data Analysts:

Professionals seeking efficient data extraction methods.

DevOps Teams:

Teams automating data processing tasks in their workflows.

Installation

Getting started with rjq is easy. Binaries for both Linux and Windows are available in the releases section of the GitHub repository, allowing users to install the tool without hassle.

Conclusion

Whether you’re a developer, data analyst, or part of a DevOps team, rjq offers a fast, lightweight solution for filtering JSON data. With its performance, simplicity, and growing feature set, rjq is poised to become an essential tool in your data processing arsenal. Check out the GitHub repository to learn more and get started today!

Top comments (0)