ThorstenHans.JsonPatch.Contrib
0.0.3
dotnet add package ThorstenHans.JsonPatch.Contrib --version 0.0.3
NuGet\Install-Package ThorstenHans.JsonPatch.Contrib -Version 0.0.3
<PackageReference Include="ThorstenHans.JsonPatch.Contrib" Version="0.0.3" />
paket add ThorstenHans.JsonPatch.Contrib --version 0.0.3
#r "nuget: ThorstenHans.JsonPatch.Contrib, 0.0.3"
// Install ThorstenHans.JsonPatch.Contrib as a Cake Addin #addin nuget:?package=ThorstenHans.JsonPatch.Contrib&version=0.0.3 // Install ThorstenHans.JsonPatch.Contrib as a Cake Tool #tool nuget:?package=ThorstenHans.JsonPatch.Contrib&version=0.0.3
ThorstenHans.JsonPatch.Contrib
The main purpose of this NuGet package is to simplify the usage of JsonPatchDocument<T>
(Microsoft.AspNetCore.JsonPatch
) when generating JSON patch expressions.
This is especially handy when working with SDKs like for example the official Kubernetes Client SDK for C#.
The package takes care about specifying proper ContractResolvers
and producing valid JSON patch expressions as string
by removing unsupported properties before serializing into a string.
public class TestModel
{
public string FirstName { get; set; }
public int Age { get; set; }
}
public class Examples
{
public static void Sample1()
{
var doc = JsonPatchDocumentBuilder.BuildFor<TestModel>();
doc.Replace(t => t.FirstName, "John");
doc.Replace(t => t.Age, 42);
var patchString = doc.ToJsonPatch();
Console.WriteLine(patchString);
}
}
Invoking Examples.Sample1()
will print the following string to the console:
[
{
"path":"/firstName",
"op":"replace",
"value":"John"
},
{
"path":"/age",
"op":"replace",
"value":42
}
]
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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. |
-
net6.0
- Microsoft.AspNetCore.JsonPatch (>= 6.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.