Partial.SystemTextJson 8.0.5-rc1

This is a prerelease version of Partial.SystemTextJson.
dotnet add package Partial.SystemTextJson --version 8.0.5-rc1
                    
NuGet\Install-Package Partial.SystemTextJson -Version 8.0.5-rc1
                    
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="Partial.SystemTextJson" Version="8.0.5-rc1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Partial.SystemTextJson" Version="8.0.5-rc1" />
                    
Directory.Packages.props
<PackageReference Include="Partial.SystemTextJson" />
                    
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 Partial.SystemTextJson --version 8.0.5-rc1
                    
#r "nuget: Partial.SystemTextJson, 8.0.5-rc1"
                    
#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 Partial.SystemTextJson@8.0.5-rc1
                    
#: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=Partial.SystemTextJson&version=8.0.5-rc1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Partial.SystemTextJson&version=8.0.5-rc1&prerelease
                    
Install as a Cake Tool

Partial.SystemTextJson

System.Text.Json integration for Partial. Provides PartialJsonConverter which enables automatic property tracking during System.Text.Json deserialization.

Overview

When deserializing JSON into a partial model using the standard System.Text.Json deserializer, the property tracking information is lost because the default converter doesn't notify the Partial<TSelf> base class about which properties were actually present in the Json.

PartialJsonConverter solves this by implementing a custom JsonConverterFactory that properly tracks which properties are deserialized, allowing IsDefined() and IsUndefined() to work correctly.

Installation

dotnet add package Partial.SystemTextJson

This will automatically include Partial.Core as a dependency.

Usage

Basic Setup

Register the converter with your JsonSerializerOptions:

using System.Text.Json;
using System.Text.Json.Serialization;
using Partial.SystemTextJson;

var options = new JsonSerializerOptions
{
    Converters = { new PartialJsonConverter() }
};

Deserialization

var json = """
{
    "username": "alice",
    "email": "alice@example.com"
}
""";

var user = JsonSerializer.Deserialize<UserUpdate>(json, options);

// Properties from Json are now tracked
if (user.IsDefined(u => u.Username)) { /* true */ }
if (user.IsDefined(u => u.Email)) { /* true */ }
if (user.IsUndefined(u => u.Age)) { /* true */ }

Serialization

Only properties that were defined are serialized back to Json:

var user = JsonSerializer.Deserialize<UserUpdate>(json, options);
var serialized = JsonSerializer.Serialize(user, options);
// Result contains only the properties that were defined:

Console.WriteLine(serialized); // {"username": "alice", "email": "alice@example.com"}
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 was computed.  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.

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
8.0.5-rc1 92 2/13/2026