Created a simple query language for JSON data.
Features:
- Basic query selection
- Fallback Mechanism
- Wildcard support
- Array Slices
- Multiple Key Selection
- Key Omission
- Single Key Omission
- Functions
- Comparison Operators
- Conditions
- Configurable
Here's an example to get the list of adult friends:
$.friends[?(@.age >= 18)]
Runs in browsers, and Node.js
Documentation site: https://jqlite.vercel.app/
GitHub: https://github.com/Jay-Karia/jqlite
NPM Package: https://www.npmjs.com/package/jqlite-ts
⭐ Leaving a star on GitHub is much appreciated!

12 Comments
Azzu@lemm.ee · 9 pts · 1y
https://jqlang.org/
I've been using that for all my JSON extraction and processing needs. Let me automate a bunch of my builds for JS stuff for FoundryVTT https://gitlab.com/foundry-azzurite/pings/-/blob/master/build/build.sh
jay0072007@programming.dev · 4 pts · 1y
Thanks for sharing the project! JQLite is aimed to run in browsers and node, but will definitely take inspiration from "jq".
Azzu@lemm.ee · 14 pts · 1y
I just kinda wonder why when you're in a browser or node, you wouldn't just do
why learn another language when you already literally got the language to process JavaScript Object Notation right there.
jay0072007@programming.dev · 9 pts · 1y
100% agreed. It's just a learning/hobby project, to know more about parsers, and how languages work. Some of the features like Wildcard, Multiple key selection/omission comes handy, and might add more features like that.
Azzu@lemm.ee · 5 pts · 1y
Totally fair. Sounds fun :)
_Vi@programming.dev · 6 pts · 1y
At first I thought that it is like SQLite, but for JSON, not just "JQ-lite".
Speaking of JSON and queries, it is worth to mention DuckDB's JSON features. This allows you to use actual SQL to query JSON.
Here is example of a DuckDB analogue of
$.orders[?(@.status.#equals('delivered'))][*].itemsfrom JQLite documentation:jay0072007@programming.dev · 1 pts · 1y
That's actually great to query JSON with SQL! But as you can see the example from DuckDB is quite complex and unreadable as well.
And I have made this project for learning purpose and to challenge myself.
However, Thanks for sharing the project.
SchwertImStein@lemmy.dbzer0.com · 4 pts · 1y
https://github.com/bazaarvoice/jolt
jay0072007@programming.dev · 5 pts · 1y
That's a great project! JQLite is mainly focused on query-style approach. Also it's a hobby project for learning parsers and stuff.
Thorry84@feddit.nl · 3 pts · 1y
You might want to look into using some form of parameterized queries.
jay0072007@programming.dev · 3 pts · 1y
Thanks for your suggestion! It's definitely something I'll look into.
angelmountain@feddit.nl · 0 pts · 1y
Which animal's @$$ does this whip?