Enigmatry.Entry.SmartEnums.SystemTextJson 9.1.1-preview.5

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

Smart Enums System.Text.Json Integration

This library provides System.Text.Json integration for the Smart Enums feature, allowing proper serialization and deserialization of smart enum types.

Intended Usage

Use this library when you need to serialize/deserialize Smart Enum types using System.Text.Json in your application.

Installation

Add the package to your project:

dotnet add package Enigmatry.Entry.SmartEnums.SystemTextJson

Usage Example

Register Smart Enum JSON converters in your application:

using Enigmatry.Entry.SmartEnums.SystemTextJson;
using System.Reflection;
using System.Text.Json;

// Configure JSON options
var options = new JsonSerializerOptions
{
    PropertyNamingPolicy = JsonNamingPolicy.CamelCase
};

// Add Smart Enum converters for all SmartEnum types in specified assemblies
// Choose ValueConverter to serialize by the enum's numeric value
options.Converters.EntryAddSmartEnumJsonConverters(
    SmartEnumConverterType.ValueConverter, 
    new[] { Assembly.GetExecutingAssembly() });

// Use in serialization/deserialization
var json = JsonSerializer.Serialize(myObject, options);
var deserialized = JsonSerializer.Deserialize<MyClass>(json, options);

Dependency Injection Example

When using ASP.NET Core:

using Enigmatry.Entry.SmartEnums.SystemTextJson;
using System.Reflection;
using Microsoft.Extensions.DependencyInjection;

public void ConfigureServices(IServiceCollection services)
{
    services.AddControllers()
        .AddJsonOptions(options =>
        {
            // Add Smart Enum converters for all SmartEnum types in the current assembly
            // You can also use NameConverter to serialize by the enum's name
            options.JsonSerializerOptions.Converters.EntryAddSmartEnumJsonConverters(
                SmartEnumConverterType.NameConverter,
                new[] { Assembly.GetExecutingAssembly() });
        });
}
Product 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.

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
9.1.1-preview.5 175 8/8/2025
9.1.1-preview.4 96 6/27/2025
9.1.1-preview.3 125 6/4/2025
9.1.0 150 6/3/2025
9.0.1-preview.8 131 5/26/2025
9.0.1-preview.7 215 5/13/2025
9.0.1-preview.6 290 5/9/2025
9.0.1-preview.5 155 5/7/2025
9.0.1-preview.4 129 4/30/2025
9.0.1-preview.2 133 4/1/2025
9.0.0 165 2/26/2025
8.1.1-preview.3 128 5/7/2025
8.1.1-preview.1 134 4/1/2025
8.1.0 309 2/19/2025
8.0.1-preview.4 81 2/7/2025
8.0.1-preview.2 60 1/15/2025
8.0.0 748 11/27/2024
3.4.6-preview.10 77 11/27/2024
3.4.3 412 10/22/2024
3.4.2 454 10/11/2024
3.4.1 120 10/9/2024
3.4.0 112 10/9/2024
3.3.2 253 8/28/2024
3.3.2-preview.7 91 8/27/2024