JsonToLinq 1.0.0-rc910

This is a prerelease version of JsonToLinq.
There is a newer version of this package available.
See the version list below for details.
dotnet add package JsonToLinq --version 1.0.0-rc910
                    
NuGet\Install-Package JsonToLinq -Version 1.0.0-rc910
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="JsonToLinq" Version="1.0.0-rc910" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="JsonToLinq" Version="1.0.0-rc910" />
                    
Directory.Packages.props
<PackageReference Include="JsonToLinq" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add JsonToLinq --version 1.0.0-rc910
                    
#r "nuget: JsonToLinq, 1.0.0-rc910"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package JsonToLinq@1.0.0-rc910
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=JsonToLinq&version=1.0.0-rc910&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=JsonToLinq&version=1.0.0-rc910&prerelease
                    
Install as a Cake Tool

JsonToLinq

JsonToLinq - lightweight C# library that converts JSON-based query definitions into LINQ expressions. Ideal for building dynamic filters, predicates, and queries.

๐ŸŽฏ Use Cases

JsonToLinq can be applied in various scenarios where dynamic, runtime-defined queries are needed. Examples include:

  • Server-side filtering: Apply JSON-defined filters received from front-end applications to collections or database queries.
  • Dynamic reporting: Build complex filters and predicates for reports without hardcoding logic.
  • Custom dashboards: Let users define queries for dashboards dynamically and translate them to LINQ expressions.
  • EF Core / Entity Framework queries: Map JSON filters directly to LINQ queries executed on the database.
  • Audit & logging filters: Dynamically select subsets of data based on JSON rules for auditing or logging purposes.

๐Ÿš€ Quick Start

using Neomaster.JsonToLinq;

var users = source.Where(
  """
  {
    "Logic": "&&",
    "Rules": [
      {
        "Field": "balance",
        "Operator": "=",
        "Value": 0
      },
      {
        "Logic": "||",
        "Rules": [
          {
            "Field": "lastVisitAt",
            "Operator": "=",
            "Value": null
          },
          {
            "Field": "lastVisitAt",
            "Operator": "<=",
            "Value": "2025-01-01T00:00:00Z"
          }
        ]
      }
    ]
  }
  """);

๐Ÿ“Œ Default Operator Mapping

JSON LINQ Expression Description
& Expression.And Bitwise AND
&& Expression.AndAlso Logical AND
| Expression.Or Bitwise OR
|| Expression.OrElse Logical OR
= Expression.Equal Equal
!= Expression.NotEqual Not equal
> Expression.GreaterThan Greater than
>= Expression.GreaterThanOrEqual Greater than or equal
< Expression.LessThan Less than
<= Expression.LessThanOrEqual Less than or equal

๐Ÿ”ฌ Demos and Experiments

This repository contains a project with working examples. You are welcome to submit a PR with your own examples, bug reports, or new features. To describe a filter, use the following notation:

๐Ÿ”ค Filter Notation

Syntax

expr = logic[expr(, expr)*]
  • expr - a single rule or a combination of rules
  • logic - an operator used to combine multiple rules, e.g. &&, &, ||, |, or a custom one

Examples

  1. &&[x = null]
  2. &&[a < 0, b > 0]
  3. &&[x = null, ||[a < 0, b > 0]]

๐Ÿ’ป Demo Project

This project provides examples of working with EF Core and a PostgreSQL database.

๐Ÿงช A real database is used instead of in-memory storage, ensuring clean and realistic experiments.

โž• You can add your own examples with other databases or ORMs via a PR.

โ–ถ๏ธ Before running the demos, select the first menu item, Prepare Data, to apply migrations and populate the tables with test data.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 164 1/3/2026
1.0.0-rc923 270 1/2/2026
1.0.0-rc922 123 1/2/2026
1.0.0-rc921 124 1/2/2026
1.0.0-rc920 122 1/2/2026
1.0.0-rc918 118 1/2/2026
1.0.0-rc917 124 1/2/2026
1.0.0-rc916 156 12/20/2025
1.0.0-rc915 161 12/20/2025
1.0.0-rc914 205 12/19/2025
1.0.0-rc913 267 12/19/2025
1.0.0-rc912 270 12/19/2025
1.0.0-rc911 294 12/18/2025
1.0.0-rc910 308 12/17/2025
1.0.0-rc909 292 12/17/2025
1.0.0-rc908 147 12/13/2025
1.0.0-rc907 149 12/13/2025
1.0.0-rc906 148 12/12/2025
1.0.0-rc905 435 12/11/2025
1.0.0-rc904 474 12/9/2025
Loading failed