JsonPathToModel 2.2.0
dotnet add package JsonPathToModel --version 2.2.0
NuGet\Install-Package JsonPathToModel -Version 2.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="JsonPathToModel" Version="2.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="JsonPathToModel" Version="2.2.0" />
<PackageReference Include="JsonPathToModel" />
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 JsonPathToModel --version 2.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: JsonPathToModel, 2.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.
#addin nuget:?package=JsonPathToModel&version=2.2.0
#tool nuget:?package=JsonPathToModel&version=2.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
JsonPathToModel
Use JSONPath to navigate through .NET in-memory models
DI registration:
// program
...
services.AddJsonPathToModel(options =>
{
options.OptimizeWithCodeEmitter = true;
});
...
// constructor
public void MyService(IJsonPathModelNavigator navigator)
...
Usage:
var model = new SampleModel
{
Id = "7",
Name = "Gerry",
Nested = new([new SampleNested { Id = "xyz", Name = "Pedro" }])
};
var navi = new JsonPathModelNavigator();
var resultSingle = navi.GetValue(model, "$.Id");
navi.GetValue(model, "$.Nested[0].Name");
var resultValues = navi.SelectValues(model, "$.Nested[*].Id");
navi.SelectValues(model, "$.Nested[*].Name");
navi.SetValue(model, "$.Nested[0].Name", "Abdula");
Model:
public class SampleModel
{
public string Id { get; set; }
public string Name { get; set; }
public List<SampleNested> Nested { get; set; } = [];
}
public class SampleNested
{
public string Id { get; set; }
public string Name { get; set; }
}
Release Notes
2.1.0+
- added ExecutePrivate and ExecutePrivateStatic reflection extentions
2.0.0+
- support of DateTimeOffset and DateOnly with tests
- migrated to .NET9
1.6.0+
- added HackingExtensions: WithHack, StealValue, StealString
- upgraded System.Text.Json to 8.0.5
1.5.0+
- added ModelStateExplorer to create JsonPath for type properties and fields
- added support of fields
- added support of nonpublics
- added ModelSnapshot to extract model state into a serializable form
1.3.0 - 1.3.2
- fixed few bugs
- extended ReflectionHelper to support JsonIgnore
1.2.6
- fixed a few bugs in tokenizer
1.2.5
- fixed bug in auto-convert for SetValue, it works now when OptimizeWithCodeEmitter = true too
1.2.0 - 1.2.4:
- Dramatically improved performance
- Added DI services registration
- Added Sigil Emitter optimizations for GetValue/SetValue simple expressions like '$.Person.FirstName'
- Added Tokenizer for parsing JSONPath expressions
- Added DateTime auto-convert for SetValue, it works only when OptimizeWithCodeEmitter = false
- Refactored exceptions
- → NETStandard2.1
- Breaking changes: GetValue now throws exceptions, for Result<> pattern use GetValueResult
1.0.0 - 1.1.0:
- Initital import from ProCodersPtyLtd/BlazorForms
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- FluentResults (>= 3.16.0)
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Portable.System.DateTimeOnly (>= 8.0.1)
- Sigil (>= 5.0.0)
- System.Text.Json (>= 9.0.4)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on JsonPathToModel:
Package | Downloads |
---|---|
MicroFlows
Use MicroFlows to implement Stateful workflows for microservices |
|
MicroForms
Low-code form builder with advanced rule engine and microflows support for microservices |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
2.2.0 | 135 | 10 days ago | |
2.1.0 | 132 | 11 days ago | |
2.0.0 | 169 | a month ago | |
1.6.1 | 1,642 | 8 months ago | |
1.6.0 | 152 | 9 months ago | |
1.5.7 | 165 | 9 months ago | |
1.5.6 | 447 | 9 months ago | |
1.5.5 | 148 | 9 months ago | |
1.5.4 | 119 | 9 months ago | |
1.5.3 | 194 | 9 months ago | |
1.5.2 | 120 | 9 months ago | |
1.5.1 | 125 | 9 months ago | |
1.5.0 | 124 | 9 months ago | |
1.4.0 | 194 | 9 months ago | |
1.3.2 | 226 | 9 months ago | |
1.3.1 | 244 | 9 months ago | |
1.3.0 | 122 | 9 months ago | |
1.2.6 | 121 | 9 months ago | |
1.2.5 | 128 | 9 months ago | |
1.2.4 | 122 | 9 months ago | |
1.2.3 | 115 | 9 months ago | |
1.2.2 | 123 | 9 months ago | |
1.2.1 | 129 | 9 months ago | |
1.2.0 | 166 | 9 months ago | |
1.1.0 | 128 | 10 months ago | |
1.0.1 | 147 | 10 months ago | |
1.0.0 | 148 | 10 months ago |