Iyume.JsonPath
0.1.0
dotnet add package Iyume.JsonPath --version 0.1.0
NuGet\Install-Package Iyume.JsonPath -Version 0.1.0
<PackageReference Include="Iyume.JsonPath" Version="0.1.0" />
<PackageVersion Include="Iyume.JsonPath" Version="0.1.0" />
<PackageReference Include="Iyume.JsonPath" />
paket add Iyume.JsonPath --version 0.1.0
#r "nuget: Iyume.JsonPath, 0.1.0"
#:package Iyume.JsonPath@0.1.0
#addin nuget:?package=Iyume.JsonPath&version=0.1.0
#tool nuget:?package=Iyume.JsonPath&version=0.1.0
Iyume.JsonPath
JsonPath compile-time weaving for .NET 10 via C# 14 Interceptors and Incremental Source Generators. Zero runtime parsing overhead for literal paths — the source generator rewrites your JsonPath strings to hard-coded extension method chains at compile time.
Features
- Compile-time literal interception —
JsonPath.Select(root, "$.store.book[*].title")is rewritten by the compiler into direct method calls, no parsing at runtime - Partial method code-gen —
[JsonPath(typeof(JsonNode), "$..author")]on a partial method generates the body - Runtime interpreter — for paths from external input (config, user input, network)
- RFC 9535 compliant parser with full filter expression support
- Supports:
System.Text.Json.Nodes.JsonNodeSystem.Text.Json.JsonElementNewtonsoft.Json.Linq.JToken(via optionalIyume.JsonPath.Newtonsoftpackage)
Installation
# Core package (System.Text.Json support)
dotnet add package Iyume.JsonPath
# Optional: Newtonsoft.Json support
dotnet add package Iyume.JsonPath.Newtonsoft
Interceptor setup
To use JsonPath.Select() with string literals, add the interceptor namespace to your .csproj:
<InterceptorsNamespaces>$(InterceptorsNamespaces);Iyume.JsonPath.Compiler.Generated</InterceptorsNamespaces>
Quick Start
1. Compile-time: Interceptor (JsonPath.Select)
using System.Text.Json.Nodes;
using Iyume.JsonPath.Compiler;
var root = JsonNode.Parse(jsonString);
// The string literal "$.store.book[*].title" is intercepted at compile time
// and replaced with generated extension method calls — zero parsing overhead.
var titles = JsonPath.Select(root, "$.store.book[*].title");
2. Compile-time: Partial Method ([JsonPath])
using System.Text.Json.Nodes;
using Iyume.JsonPath.Compiler;
[JsonPath(typeof(JsonNode), "$.store.book[?(@.price < 10)].title")]
public static partial IEnumerable<JsonNode?> GetCheapBookTitles(JsonNode root);
3. Runtime: Interpreter
using System.Text.Json.Nodes;
using Iyume.JsonPath.Interpreter;
var root = JsonNode.Parse(jsonString);
// For paths from external input — pre-parse once for repeated queries
var ast = JsonPathParser.Parse("$.store.book[*].author");
var authors = JsonPathInterpreter.Evaluate(root, ast);
Supported JsonPath Syntax
| Syntax | Example | Description |
|---|---|---|
| Root | $ |
Root node |
| Dot notation | $.store.book |
Child access |
| Bracket notation | $['store']['book'] |
Child access with quotes |
| Wildcard | $.store.book[*] or $.* |
All children |
| Index | $.store.book[0] or $.store.book[-1] |
Array index (negative supported) |
| Slice | $.store.book[0:2] or $.store.book[0:10:2] |
Array slice with optional step |
| Descendant | $..author or $..* |
Recursive descent |
| Multiple selectors | $['store','warehouse'] |
Comma-separated names |
| Filter — exists | $.store.book[?@.isbn] |
Property existence check |
| Filter — comparison | $.store.book[?(@.price < 10)] |
Value comparison (<, >, <=, >=, ==, !=) |
| Filter — logical | $.store.book[?(@.price < 15 && @.category == 'fiction')] |
&&, ||, ! |
| Filter — functions | $.store.book[?length(@.author) > 10] |
length(), count() |
Build
# Build
dotnet build Iyume.JsonPath.slnx
# Run tests
dotnet test tests/Iyume.JsonPath.Tests.csproj
# Run benchmarks
dotnet run -c Release --project benchmarks/Iyume.JsonPath.Benchmarks/Iyume.JsonPath.Benchmarks.csproj
Requirements
- .NET 10 (net10.0)
- C# 14
License
MIT — see LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Iyume.JsonPath:
| Package | Downloads |
|---|---|
|
Iyume.JsonPath.Newtonsoft
Newtonsoft.Json (JToken) support for Iyume.JsonPath — navigation extensions and runtime interpreter. Install this package alongside Iyume.JsonPath only if you work with Newtonsoft.Json.Linq types. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0 | 142 | 7/9/2026 |