JsonPathToModel 1.6.1
dotnet add package JsonPathToModel --version 1.6.1
NuGet\Install-Package JsonPathToModel -Version 1.6.1
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="1.6.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JsonPathToModel --version 1.6.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: JsonPathToModel, 1.6.1"
#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.
// Install JsonPathToModel as a Cake Addin #addin nuget:?package=JsonPathToModel&version=1.6.1 // Install JsonPathToModel as a Cake Tool #tool nuget:?package=JsonPathToModel&version=1.6.1
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
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 | 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. |
.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.
-
.NETStandard 2.1
- FluentResults (>= 3.16.0)
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Portable.System.DateTimeOnly (>= 8.0.1)
- Sigil (>= 5.0.0)
- System.Text.Json (>= 8.0.5)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on JsonPathToModel:
Package | Downloads |
---|---|
MicroFlows
Use MicroFlows to implement Stateful workflows for microservices |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
1.6.1 | 469 | 10/14/2024 | |
1.6.0 | 119 | 9/21/2024 | |
1.5.7 | 143 | 9/16/2024 | |
1.5.6 | 425 | 9/16/2024 | |
1.5.5 | 123 | 9/14/2024 | |
1.5.4 | 96 | 9/14/2024 | |
1.5.3 | 166 | 9/13/2024 | |
1.5.2 | 97 | 9/13/2024 | |
1.5.1 | 101 | 9/13/2024 | |
1.5.0 | 105 | 9/13/2024 | |
1.4.0 | 172 | 9/9/2024 | |
1.3.2 | 206 | 9/6/2024 | |
1.3.1 | 225 | 9/2/2024 | |
1.3.0 | 101 | 9/2/2024 | |
1.2.6 | 98 | 8/29/2024 | |
1.2.5 | 103 | 8/29/2024 | |
1.2.4 | 103 | 8/27/2024 | |
1.2.3 | 93 | 8/27/2024 | |
1.2.2 | 103 | 8/26/2024 | |
1.2.1 | 98 | 8/26/2024 | |
1.2.0 | 146 | 8/25/2024 | |
1.1.0 | 108 | 8/20/2024 | |
1.0.1 | 127 | 8/19/2024 | |
1.0.0 | 129 | 8/19/2024 |