https://github.com/Jay-Karia/jqlite
⚡ The query language for JSON
https://github.com/Jay-Karia/jqlite
configurable fast json query-language simple
Last synced: about 2 months ago
JSON representation
⚡ The query language for JSON
- Host: GitHub
- URL: https://github.com/Jay-Karia/jqlite
- Owner: Jay-Karia
- License: mit
- Created: 2025-01-23T17:45:04.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-05-10T05:07:59.000Z (8 months ago)
- Last Synced: 2025-05-10T05:18:01.643Z (8 months ago)
- Topics: configurable, fast, json, query-language, simple
- Language: TypeScript
- Homepage: https://jqlite.vercel.app
- Size: 1.32 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
- awesome-typescript - jqlite - ⚡ The query language for JSON (Tools / IDE)
README
JQLite
The query language for JSON
---
### 🌟 Features
- **Basic query selection**
- **Fallback Mechanism**
- **Wildcard support**
- **Array Slices**
- **Multiple Key Selection**
- **Key Omission**
- **Single Key Omission**
- **Functions**
- **Comparison Operators**
- **Conditions**
- **Configurable**
### 📦 Installation
```sh
# npm
npm install jqlite-ts
# yarn
yarn add jqlite-ts
# pnpm
pnpm add jqlite-ts
```
### 🚀 Getting Started
```js
import { config, data, query } from 'jqlite-ts';
// Load the data from a JSON file
data.load("./data.json");
// Override the default config
config.set({
fallback: "No data found!"
});
// Run the query
query.run("$.friends[*].(name, age)", (result) => {
console.log(result);
});
```
### 📌 Overview
```js
// Basic Selection
$.friends[0].name
// Fallback
$.friends[0].favorites.game ?? "No favorite game"
// Wildcard
$.friends[*].name
// Array Slices
$.friends[0:2].name
// Multiple Key Selection
$.friends[0].(name, age)
// Multiple Key Omission
$.friends[0].!(name, age)
// Single Key Omission
$.friends[0].!name
// Functions
$.friends[0].name.#upper()
$.friends[*].age.#avg()
$.friends[*].hobbies.#length()
// Comparison Operators
$.friends[0].age > 20
// Conditions
$.friends[?(@.age >= 18)]
$.friends[?(@.country.#contains('IN'))].name
$.scores[?((@ > 150) || (@ < 100))]
$.friends[?((@.age > 20) && (@.hobbies[0].#contains('sports')))]
```
---
### 📝 Contributing
Read the [CONTRIBUTING.md](/CONTRIBUTING.md) file for instructions on how to contribute to this project.