JSONPredicate 1.2.0
dotnet add package JSONPredicate --version 1.2.0
NuGet\Install-Package JSONPredicate -Version 1.2.0
<PackageReference Include="JSONPredicate" Version="1.2.0" />
<PackageVersion Include="JSONPredicate" Version="1.2.0" />
<PackageReference Include="JSONPredicate" />
paket add JSONPredicate --version 1.2.0
#r "nuget: JSONPredicate, 1.2.0"
#:package JSONPredicate@1.2.0
#addin nuget:?package=JSONPredicate&version=1.2.0
#tool nuget:?package=JSONPredicate&version=1.2.0
What is JSONPredicate?
.Net library to provide a powerful and intuitive way to evaluate string-based predicate expressions against JSON objects using JSONPath syntax.
Features
- JSONPath Support: Access
nestedobject properties usingdotnotation - Multiple Operators:
eq(equal),in(contains),not(not equal),gt(greater than),gte(greater than or equal),lt(less than),lte(less than or equal) - Logical Operators:
and,orwith proper precedence handling - Array Handling: Evaluate conditions on
arraysandcollections. Support arrayindexing(Available from v1.1.0) - String Operations:
starts_with,ends_with,contains(Available from v1.1.0) - Type Safety:
Automatictype conversion and validation - Complex Expressions:
Parenthesesgrouping andnestedoperations - Lightweight:
Minimaldependencies,fastevaluation - Thread-Safe: Safe for use in
multi-threadedenvironments - Performance Optimized: Efficient parsing and evaluation for
high-performancescenarios
Installation
Install via NuGet Package Manager:
NuGet\Install-Package JsonPredicate
Getting Started
The library provides a powerful, flexible way to evaluate complex conditional logic against JSON objects, making it ideal for business rules, filtering, validation, and many other use cases in .NET applications.
i. Expression Syntax
The expression syntax is ([JSONPath] [Comparison Operator] [Value]) [Logical Operator] ([JSONPath] [Comparison Operator] [Value])
ii. Supported Operators
- Comparison Operators -
eq,in,gt,gte,lt,lte&Not - Logical Operators -
and&or - String Operators -
starts_with,ends_with,contains(Available from v1.2.0)
Example
var customer = new {
client = new {
address = new {
postcode = "e113et",
number = 123,
active = true
},
tags = new[] { "vip", "premium" }
},
score = 95.5
};
i. Simple equality
bool result1 = JSONPredicate.Evaluate("client.address.postcode eq `e113et`", customer);
ii. Logical operators
bool result2 = JSONPredicate.Evaluate("client.address.postcode eq `e113et` and client.address.number eq 123", customer);
iii. Array operations
bool result3 = JSONPredicate.Evaluate("client.tags in [`vip`, `standard`]", customer);
bool
iv. String operators (Available from v1.2.0)
bool result4 = JSONPredicate.Evaluate("client.address.postcode starts_with `e11`", customer);
bool result5 = JSONPredicate.Evaluate("client.address.postcode ends_with `3et`", customer);
bool result6 = JSONPredicate.Evaluate("client.address.postcode contains `13`", customer);
v. Deep Array Indexing (Available from v1.2.0)
bool result7 = JSONPredicate.Evaluate("client.tags[1] eq `premium`", customer);
Developer Guide
Please see Developer Guide for comprehensive documentation to integrate JSONPredicate in your project.
Release Roadmap
This section provides the summary of planned releases with key details about each release.
| Version | Release Date | Type | Key Improvements | Backward Compatible |
|---------|--------------|------|------------------|-------------------|
| v1.0.0 | August 2025 | Major | Initial release with core predicate evaluation | N/A |
| v1.2.0 | October 2025 | Minor | Namespace consistency, thread safety, 50%+ performance improvement, array indexing, new operators (starts_with, ends_with, contains) | Yes |
| v2.0.0 | TBC | Major | Comprehensive validation, performance benchmarking, thread safety verification, complete documentation | Mostly* |
*Note: v2.0.0 marked as "Mostly" backward compatible due to major internal changes that may affect some advanced usage patterns.
Please see Release Roadmap for more details.
License
This project is licensed under the MIT License - see the license file for details.
Contributing
We welcome contributions! Please see our Contributing Guide for details.
- 📖 Read the Documentation
- 🐛 If you are having problems, please let us know by raising a new issue here.
- 💬 Ask questions on Discussions
- 💻 Code - Submit pull requests
Credits
Thank you for reading. Please fork, explore, contribute and report. Happy Coding !! 😃
| Product | Versions 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 is compatible. 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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- System.Text.Json (>= 9.0.8)
-
.NETStandard 2.0
- System.Text.Json (>= 9.0.8)
-
.NETStandard 2.1
- System.Text.Json (>= 9.0.8)
-
net9.0
- System.Text.Json (>= 9.0.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
v1.2.0 - Enhanced JSONPredicate library with additional improvements.
- Array indexing support in JSONPath (e.g., `array[0].property`)
- New comparison operators: `starts_with`, `ends_with`, and `contains`
- Direct object navigation with 50%+ performance improvement
- Thread-safe operation in multi-threaded environments
- Optimized expression parsing without regex dependency.
For more details, visit the release page:
https://github.com/CodeShayk/JSONPredicate/releases/tag/v1.2.0