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
<PackageReference Include="Atya.Foundation.Serialization" Version="1.1.0" />
<PackageVersion Include="Atya.Foundation.Serialization" Version="1.1.0" />
<PackageReference Include="Atya.Foundation.Serialization" />
paket add Atya.Foundation.Serialization --version 1.1.0
#r "nuget: Atya.Foundation.Serialization, 1.1.0"
#:package Atya.Foundation.Serialization@1.1.0
#addin nuget:?package=Atya.Foundation.Serialization&version=1.1.0
#tool nuget:?package=Atya.Foundation.Serialization&version=1.1.0
Atya.Foundation.Serialization
Shared System.Text.Json defaults for Atya foundation packages.
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
JsonSerializerOptionsthroughJsonSerializerConfiguration.Default. - Fresh mutable copies through
JsonSerializerConfiguration.CreateDefault(). - In-place configuration through
JsonSerializerConfiguration.ApplyDefaults(...). - Extension helpers through
ApplyAtyaDefaults()andCreateAtyaDefaults(). - 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 | Versions 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. |
-
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.