TLio.Json.SystemText 1.2.0

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package TLio.Json.SystemText --version 1.2.0
                    
NuGet\Install-Package TLio.Json.SystemText -Version 1.2.0
                    
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="TLio.Json.SystemText" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TLio.Json.SystemText" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="TLio.Json.SystemText" />
                    
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 TLio.Json.SystemText --version 1.2.0
                    
#r "nuget: TLio.Json.SystemText, 1.2.0"
                    
#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 TLio.Json.SystemText@1.2.0
                    
#: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=TLio.Json.SystemText&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=TLio.Json.SystemText&version=1.2.0
                    
Install as a Cake Tool

TLio.Json.SystemText

The System.Text.Json adapter for TLio — INodeAdapter<JsonNode> and IItemsFetcher<JsonNode> implementations backed by System.Text.Json.Nodes and the TLio.JsonPath engine, which evaluates paths directly on the document's own nodes.

Newtonsoft.Json is not referenced. Transformation behaviour is identical to TLio.Json: the default path dialect reproduces Newtonsoft's JSONPath exactly (the same nodes, in the same order, with the same errors), and a differential test suite holds it to that against Newtonsoft.Json itself.

dotnet add package TLio.Json.SystemText
dotnet add package TLio.Client

Quick start

using System.Text.Json.Nodes;
using TLio.Client;
using TLio.Json.SystemText;

var data   = JsonNode.Parse("""{ "name": "Acme", "tempId": 7 }""");
var script = """
[
  { "command": "put",    "path": "$.status", "value": "active" },
  { "command": "remove", "path": "$.tempId" }
]
""";

var options = ParseOptions<JsonNode>.CreateDefault();
var engine  = new ScriptEngine<JsonNode>(options.CommandsProvider, options.FunctionsProvider);

var result = engine.Execute(script, data, SystemTextJsonExecutionContext.CreateDefault());

Path language

By default paths are read in the Newtonsoft dialect, so a script written for TLio.Json runs unchanged:

$.customer.name
$.orders[*].total
$.orders[?(@.total > 100)]
$.orders[?(@.name =~ /^A/i)]

Script expressions (() as an expression) are not supported, in either adapter.

Pick another dialect when you create the context:

using TLio.JsonPath;

SystemTextJsonExecutionContext.CreateDefault();                              // Newtonsoft (default)
SystemTextJsonExecutionContext.CreateDefault(JsonPathDialect.Rfc9535);       // strict RFC 9535
SystemTextJsonExecutionContext.CreateDefault(JsonPathDialect.Extended);      // Newtonsoft + RFC 9535 where Newtonsoft has no answer

// …or hand over a configured engine: custom functions, regex timeout, limits.
SystemTextJsonExecutionContext.Create(new JsonPathEngine(new JsonPathOptions { Dialect = JsonPathDialect.Rfc9535 }));
Newtonsoft (default) Rfc9535 Extended
$[?(@.price < 10)] ✓ ✓ ✓
$[?@.price < 10], $[-1], $["a"] ✗ ✓ ✓
match(), search(), length(), count(), value() ✗ ✓ ✓
=~ /re/, ===, $.a-b ✓ ✗ ✓
Matches TLio.Json exactly where the standard and Newtonsoft agree wherever Newtonsoft has an answer

The full syntax tables, the divergence table and the configuration options are in the TLio.JsonPath README.

Behaviour worth knowing

  • An invalid path throws (JsonPathException) — as Newtonsoft's SelectTokens does — instead of quietly selecting nothing.
  • SelectNode on a path that selects several nodes throws, as SelectToken does; use SelectNodes.
  • A member whose value is JSON null is selectable (it is a match with a null node; the adapter hands out a placeholder for the slot), and is told apart from a member that is absent.
  • Dates. Newtonsoft parses date-looking strings into date values, which changes how filters compare them. The default dialect reproduces that for System.Text.Json documents; see Dates in the TLio.JsonPath README, and JsonPathOptions.EmulateNewtonsoftDates to turn it off.

Coming from the JsonCons-based version

See the Migrating section of the TLio.JsonPath README: the default dialect is now Newtonsoft's, errors are no longer swallowed, and selection runs on the live document instead of a serialized snapshot.

License

MIT — see the repository.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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 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. 
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.3.0-preview.1 42 10/12/2026
1.2.0 110 10/11/2026
1.1.0 83 10/8/2026
1.1.0-preview.9 50 10/8/2026
1.1.0-preview.8 51 10/7/2026
1.1.0-preview.7 57 10/5/2026
1.1.0-preview.5 66 9/27/2026
1.1.0-preview.4 62 9/27/2026
1.1.0-preview.3 63 9/24/2026
1.1.0-preview.2 62 9/24/2026
1.1.0-preview.1 62 9/24/2026
1.0.1 441 9/24/2026
1.0.0 110 9/20/2026
0.10.0-preview.6 60 9/20/2026
0.10.0-preview.5 70 9/20/2026
0.10.0-preview.4 63 9/18/2026
0.10.0-preview.3 66 9/18/2026
0.10.0-preview.2 66 9/13/2026
0.10.0-preview.1 92 8/24/2026
0.9.0 128 8/23/2026
Loading failed