Bring the power of SQL to your JSON! 🎯
JQL.Net is a lightweight, high-performance query engine that lets you search, join, and aggregate raw JSON data using familiar SQL-like syntax. Perfect for those moments when you have complex JSON structures but don't want the overhead of a database.
- 🔍 SQL-Like Syntax: Use
SELECT,FROM,WHERE,JOIN,GROUP BY,HAVING, andORDER BY. - 🤝 Advanced Joins: Support for multiple conditions in
ONusingAND/ORlogic. - 🧮 Aggregations: Built-in support for
SUM,COUNT,AVG,MIN, andMAX. - ☁️ Case-Insensitive: Keywords like
selectorSELECT? We don't judge. It just works. - 🏷️ Alias Support: Use
ASto keep your results clean and readable. - ⚡ Lightweight: Zero database dependencies. Just you and your JSON.
Grab it on NuGet:
dotnet add package JQL.NetUsing JQL.Net is as easy as ordering pizza. Check this out:
using JQL.Net.Extensions;
using Newtonsoft.Json.Linq;
// 1. Your raw JSON data
var json = @"{
'employees': [
{ 'id': 1, 'name': 'John Doe', 'dept_id': 10, 'salary': 8000 },
{ 'id': 2, 'name': 'Jane Smith', 'dept_id': 10, 'salary': 9500 }
],
'departments': [
{ 'id': 10, 'name': 'IT', 'budget': 20000 }
]
}";
var data = JObject.Parse(json);
// 2. Write your 'SQL'
string query = @"
SELECT e.name, d.name AS DeptName
FROM $.employees AS e
JOIN $.departments AS d ON e.dept_id == d.id
WHERE e.salary > 5000";
// 3. Execute!
var results = data.Query(query);
foreach (var row in results) {
Console.WriteLine($"{row["name"]} works in {row["DeptName"]}");
}Need to link data with multiple rules? No problem:
SELECT e.name, p.proj_name
FROM $.employees AS e
JOIN $.projects AS p ON e.proj_id == p.id AND p.status == 'Active'Want to find big-spending departments?
SELECT d.name, SUM(salary) AS total_cost
FROM $.employees AS e
JOIN $.departments AS d ON dept_id == id
GROUP BY d.name
HAVING total_cost > d.budget| Keyword | Description |
|---|---|
SELECT |
Choose which fields to return (supports Aliases). |
FROM |
Define the JSON path (default is $). |
JOIN |
Combine two JSON arrays with ON logic. |
WHERE |
Filter results with ==, !=, >, <, etc. |
GROUP BY |
Bundle results by specific fields. |
HAVING |
Filter aggregated groups. |
ORDER BY |
Sort your output. |
We’re just warming up — the journey has only begun! Here’s a sneak peek at what’s bubbling in the pot for upcoming releases 🍲✨
- DISTINCT: Say goodbye to duplicate rows, keep it clean!
- Pagination: Add LIMIT & OFFSET so giant JSON arrays don’t scare you.
- Subqueries: Queries inside queries… inception style 🎬
- Set Ops: UNION & UNION ALL to mix and match results.
- Culture-Aware Sorting: Smarter sorting that respects your locale.
- Pattern Matching: LIKE & REGEX for ninja-level text searches 🥷
- Ranges & Sets: IN and BETWEEN to keep filters simple.
- Conditional Logic: CASE WHEN … THEN … ELSE for dynamic tricks.
- Null Safety: IS NULL & IS MISSING so you don’t trip over empty values.
- String Toolkit: CONCAT, UPPER, LOWER, SUBSTRING — the usual suspects.
- Date & Time: YEAR(), MONTH(), DAY() — because time matters ⏰
- Type Casting: CAST() to keep your data in line.
- Coalesce: Grab the first non-null value like a pro.
- Custom Functions API: Plug in your own C# magic directly into queries.
- Query Caching: Faster runs with smart caching.
- Prepared Statements: Cleaner queries with parameters (@id, etc).
- Async Execution: ExecuteAsync for smooth non-blocking vibes.
- Schema Discovery: DESCRIBE your JSON structure like a boss.
- Multi-Format Export: CSV, XML, DataTable — pick your flavor 🍦
- Query Profiler: Spot bottlenecks before they slow you down.
💡 This roadmap is a living list — features may shuffle, evolve, or surprise you along the way. Stay tuned, and let’s keep pushing JSON querying to the next level! 🚀
Got a cool idea or found a bug? 🐛
- Fork it!
- Create your feature branch (
git checkout -b feature/cool-stuff) - Commit your changes (
git commit -m 'Add some cool stuff') - Push to the branch (
git push origin feature/cool-stuff) - Open a Pull Request.
This project is licensed under the MIT License.
Made with ❤️ for the .NET Community. If you find JQL.Net useful, give it a ⭐ on GitHub!