PosInformatique.Foundations.EmailAddresses.Json
1.0.0
Prefix Reserved
There is a newer prerelease version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package PosInformatique.Foundations.EmailAddresses.Json --version 1.0.0
NuGet\Install-Package PosInformatique.Foundations.EmailAddresses.Json -Version 1.0.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="PosInformatique.Foundations.EmailAddresses.Json" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PosInformatique.Foundations.EmailAddresses.Json" Version="1.0.0" />
<PackageReference Include="PosInformatique.Foundations.EmailAddresses.Json" />
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 PosInformatique.Foundations.EmailAddresses.Json --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: PosInformatique.Foundations.EmailAddresses.Json, 1.0.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 PosInformatique.Foundations.EmailAddresses.Json@1.0.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=PosInformatique.Foundations.EmailAddresses.Json&version=1.0.0
#tool nuget:?package=PosInformatique.Foundations.EmailAddresses.Json&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
PosInformatique.Foundations.EmailAddresses.Json
Introduction
Provides a System.Text.Json converter for the EmailAddress value object from
PosInformatique.Foundations.EmailAddresses. Enables seamless serialization and deserialization
of RFC 5322 compliant email addresses within JSON documents.
Install
You can install the package from NuGet:
dotnet add package PosInformatique.Foundations.EmailAddresses.Json
This package depends on the base package PosInformatique.Foundations.EmailAddresses.
Features
- Provides a
JsonConverter<EmailAddress>for serialization and deserialization. - Ensures validation of RFC 5322 compliant email addresses when deserializing.
- Can be used via attributes (
[JsonConverter]) or throughJsonSerializerOptionsextension method. - Ensures consistency with the base
EmailAddressvalue object.
Use cases
- Serialization: Convert value objects into JSON strings without losing semantics
- Validation: Guarantee that only valid RFC 5322 email addresses are accepted in JSON payloads
- Integration: Plug directly into
System.Text.Jsonconfiguration
Examples
Example 1: DTO with [JsonConverter] attribute
using System.Text.Json;
using System.Text.Json.Serialization;
using PosInformatique.Foundations.EmailAddresses;
using PosInformatique.Foundations.EmailAddresses.Json;
public class UserDto
{
[JsonConverter(typeof(EmailAddressJsonConverter))]
public EmailAddress Email { get; set; } = default!;
}
// Serialization
var dto = new UserDto { Email = "john.doe@example.com" };
var json = JsonSerializer.Serialize(dto);
// Result: {"Email":"john.doe@example.com"}
// Deserialization
var input = "{ "Email": "alice@company.org" }";
var deserialized = JsonSerializer.Deserialize<UserDto>(input);
Console.WriteLine(deserialized!.Email); // "alice@company.org"
Example 2: Use extension method without attributes
using System.Text.Json;
using PosInformatique.Foundations.EmailAddresses;
public class CustomerDto
{
public EmailAddress Email { get; set; } = default!;
}
var options = new JsonSerializerOptions().AddEmailAddressesConverters();
// Serialization
var dto = new CustomerDto { Email = "bob@myapp.com" };
var json = JsonSerializer.Serialize(dto, options);
// Result: {"Email":"bob@myapp.com"}
// Deserialization
var input = "{ "Email": "carol@myapp.com" }";
var deserialized = JsonSerializer.Deserialize<CustomerDto>(input, options);
Console.WriteLine(deserialized!.Email); // "carol@myapp.com"
Links
| Product | Versions 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 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.
-
net8.0
- PosInformatique.Foundations.EmailAddresses (>= 1.0.0)
-
net9.0
- PosInformatique.Foundations.EmailAddresses (>= 1.0.0)
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 |
|---|---|---|
| 1.1.0-rc.2 | 49 | 1/26/2026 |
| 1.1.0-rc.1 | 54 | 1/23/2026 |
| 1.0.0 | 439 | 11/19/2025 |
| 1.0.0-rc.4 | 372 | 11/19/2025 |
| 1.0.0-rc.3 | 378 | 11/18/2025 |
| 1.0.0-rc.2 | 374 | 11/18/2025 |
| 1.0.0-rc.1 | 374 | 11/18/2025 |
Loading failed
1.0.0
- Initial release with the support JSON serialization (with System.Text.Json) for EmailAddress value object.