Meziantou.Framework.HumanReadableSerializer
4.0.3
Prefix Reserved
dotnet add package Meziantou.Framework.HumanReadableSerializer --version 4.0.3
NuGet\Install-Package Meziantou.Framework.HumanReadableSerializer -Version 4.0.3
<PackageReference Include="Meziantou.Framework.HumanReadableSerializer" Version="4.0.3" />
<PackageVersion Include="Meziantou.Framework.HumanReadableSerializer" Version="4.0.3" />
<PackageReference Include="Meziantou.Framework.HumanReadableSerializer" />
paket add Meziantou.Framework.HumanReadableSerializer --version 4.0.3
#r "nuget: Meziantou.Framework.HumanReadableSerializer, 4.0.3"
#:package Meziantou.Framework.HumanReadableSerializer@4.0.3
#addin nuget:?package=Meziantou.Framework.HumanReadableSerializer&version=4.0.3
#tool nuget:?package=Meziantou.Framework.HumanReadableSerializer&version=4.0.3
Meziantou.Framework.HumanReadableSerializer
One-way serializer to an invariant human-readable format. You can use HumanReadableSerializer.Serialize to convert an object to a string:
var obj = new { Name = "Gérald Barré", Nickname = "meziantou", Age = 32, MultiLineString = "line1\nline2" };
var output = HumanReadableSerializer.Serialize(obj);
output contains the following value:
Name: Gérald Barré
Nickname: meziantou
Age: 32
MultiLineString:
line1
line2
You can customize the serializer using an instance of HumanReadableSerializerOptions or by using attributes:
var options = new HumanReadableSerializerOptions()
{
IncludeFields = true,
DefaultIgnoreCondition = HumanReadableIgnoreCondition.WhenWritingNull,
};
HumanReadableSerializer.Serialize(obj, options);
Available attributes:
[HumanReadableIgnore]allows to ignore a property or a field[HumanReadableIncludeAttribute]allows to include a property or a field[HumanReadablePropertyNameAttribute]allows to set the name of a property or a field when serializing the value[HumanReadablePropertyOrderAttribute]allows to order the properties when serializing an object[HumanReadableConverterAttribute]allows to set the converter to use to serialize a property, a field, or a type
You can customize a type you don't own by using the following:
var options = new HumanReadableSerializerOptions();
// Add the HumanReadableIgnoreAttribute to the User.DisplayName property
options.AddAttribute(typeof(User), "DisplayName", new HumanReadableIgnoreAttribute());
options.IgnoreMember<User>(x => x.DisplayName);
options.IgnoreMember<User>(x => new { x.DisplayName, x.CreatedAt });
| 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. net11.0 is compatible. |
-
net10.0
- No dependencies.
-
net11.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Meziantou.Framework.HumanReadableSerializer:
| Package | Downloads |
|---|---|
|
Meziantou.Framework.InlineSnapshotTesting
Enables verification of objects using inline snapshots |
|
|
Meziantou.Framework.SnapshotTesting
Enables verification of objects using file-based snapshots |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.3 | 91 | 9/3/2026 |
| 4.0.2 | 1,616 | 8/23/2026 |
| 4.0.1 | 1,252 | 8/16/2026 |
| 4.0.0 | 5,937 | 7/5/2026 |
| 3.0.6 | 294 | 7/5/2026 |
| 3.0.5 | 4,202 | 6/13/2026 |
| 3.0.4 | 168 | 6/13/2026 |
| 3.0.3 | 4,593 | 5/31/2026 |
| 3.0.2 | 772 | 5/23/2026 |
| 3.0.1 | 1,567 | 5/14/2026 |
| 3.0.0 | 2,914 | 5/6/2026 |
| 2.4.22 | 4,300 | 4/25/2026 |
| 2.4.21 | 8,207 | 3/29/2026 |
| 2.4.20 | 2,552 | 3/22/2026 |
| 2.4.19 | 1,738 | 3/15/2026 |
| 2.4.18 | 6,098 | 2/22/2026 |
| 2.4.17 | 3,413 | 1/25/2026 |
| 2.4.16 | 467 | 1/18/2026 |
| 2.4.15 | 9,480 | 12/14/2025 |
| 2.4.14 | 13,206 | 11/16/2025 |