Atya.Foundation.Serialization 1.1.0

Prefix Reserved
dotnet add package Atya.Foundation.Serialization --version 1.1.0
                    
NuGet\Install-Package Atya.Foundation.Serialization -Version 1.1.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="Atya.Foundation.Serialization" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Atya.Foundation.Serialization" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Atya.Foundation.Serialization" />
                    
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 Atya.Foundation.Serialization --version 1.1.0
                    
#r "nuget: Atya.Foundation.Serialization, 1.1.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.
#:package Atya.Foundation.Serialization@1.1.0
                    
#: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=Atya.Foundation.Serialization&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Atya.Foundation.Serialization&version=1.1.0
                    
Install as a Cake Tool

Atya.Foundation.Serialization

Shared System.Text.Json defaults for Atya foundation packages.

NuGet Version Downloads net10.0 License: MIT

Overview

Atya.Foundation.Serialization provides a small, shared System.Text.Json configuration surface for packages that need consistent JSON behavior without repeating options setup in every project.

The package configures camelCase property names (dictionary keys are preserved verbatim), case-insensitive property reads, camelCase string enum values, null-value omission, and non-indented output.

Features

  • Shared read-only JsonSerializerOptions through JsonSerializerConfiguration.Default.
  • Fresh mutable copies through JsonSerializerConfiguration.CreateDefault().
  • In-place configuration through JsonSerializerConfiguration.ApplyDefaults(...).
  • Extension helpers through ApplyAtyaDefaults() and CreateAtyaDefaults().
  • No direct runtime package dependencies beyond the .NET platform libraries used by System.Text.Json.

Installation

.NET CLI

dotnet add package Atya.Foundation.Serialization

Package Manager

Install-Package Atya.Foundation.Serialization

PackageReference

<PackageReference Include="Atya.Foundation.Serialization" Version="1.0.0" />

Quick Start

using System.Text.Json;
using Atya.Foundation.Serialization;

SampleRequest request = new("Ada Lovelace", UserRole.Admin, null);

string json = JsonSerializer.Serialize(request, JsonSerializerConfiguration.Default);

SampleRequest? roundTrip = JsonSerializer.Deserialize<SampleRequest>(
    """
    {
      "FIRSTNAME": "Ada Lovelace",
      "ROLE": "admin"
    }
    """,
    JsonSerializerConfiguration.CreateDefault());

JsonSerializerOptions mutableOptions = new JsonSerializerOptions()
    .ApplyAtyaDefaults();

Console.WriteLine(json);
Console.WriteLine(roundTrip?.Role);
Console.WriteLine(mutableOptions.PropertyNameCaseInsensitive);

internal sealed record SampleRequest(string FirstName, UserRole Role, string? OptionalNote);

internal enum UserRole
{
    Unknown = 0,
    Admin = 1,
}

Usage

Use JsonSerializerConfiguration.Default when a shared read-only options instance is enough:

string json = JsonSerializer.Serialize(value, JsonSerializerConfiguration.Default);

Use CreateDefault() when a caller needs a mutable options instance based on the shared defaults:

JsonSerializerOptions options = JsonSerializerConfiguration.CreateDefault();
options.WriteIndented = true;

Use ApplyDefaults(...) or ApplyAtyaDefaults() when you already own an options instance:

JsonSerializerOptions options = new JsonSerializerOptions()
    .ApplyAtyaDefaults();

API Overview

API Purpose
JsonSerializerConfiguration.Default Shared read-only JsonSerializerOptions instance.
JsonSerializerConfiguration.CreateDefault() Creates a mutable copy of the shared defaults.
JsonSerializerConfiguration.ApplyDefaults(JsonSerializerOptions) Applies the package defaults to an existing options instance.
JsonSerializerConfigurationExtensions.ApplyAtyaDefaults(this JsonSerializerOptions) Extension wrapper over ApplyDefaults(...).
JsonSerializerConfigurationExtensions.CreateAtyaDefaults() Extension-oriented factory for a mutable default options instance.
AtyaJsonDefaults.PropertyNameCaseInsensitive Constant value for case-insensitive property reads.
AtyaJsonDefaults.WriteIndented Constant value for compact JSON output.

Dependencies

The package has no direct runtime package dependencies. It uses System.Text.Json APIs from the target .NET framework.

Package Boundaries and Limitations

This package only centralizes serializer options. It does not provide a serializer abstraction, persistence model, wire protocol, source generation setup, or custom converters beyond adding a camelCase JsonStringEnumConverter when one is not already present.

Project Structure

.
|-- src/Serialization/                 Package source and NuGet README
|-- tests/Serialization.UnitTests/      Unit tests
|-- samples/Serialization.Samples.Console/  Console sample
|-- benchmarks/Serialization.Benchmarks/    BenchmarkDotNet project
|-- .github/workflows/                 CI, analysis, and publish workflows
|-- Serialization.sln                  Solution file
|-- README.md                          GitHub README
`-- LICENSE                            MIT license

Compatibility

Targets net10.0.

Testing

dotnet test ./tests/Serialization.UnitTests/Serialization.UnitTests.csproj --configuration Release

Benchmarks

Benchmarks are available under benchmarks/Serialization.Benchmarks/ for the configuration factory, in-place application, shared default reads, and serialize/deserialize paths. Run them locally with:

dotnet run --project ./benchmarks/Serialization.Benchmarks/Serialization.Benchmarks.csproj --configuration Release

Contributing

Contributions are welcome. Please open an issue or pull request on GitHub.

License

Released under the MIT license. See LICENSE for details.


About Atya Libraries

Atya.Foundation.Serialization is part of Atya Libraries, a family of focused, modern .NET libraries published under the reserved Atya.* prefix on NuGet. Every package shares the same principles: a small, clear public API, full test coverage, and consistent documentation.

Browse the full collection on GitHub and NuGet.

Made with .NET - Copyright 2026 Atya Libraries

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Atya.Foundation.Serialization:

Package Downloads
Atya.Messaging.Outbox

Transactional outbox store and relay primitives for reliable Atya messaging.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 224 11/27/2026
1.0.2 81 11/26/2026
1.0.0 431 5/2/2026