Meziantou.Framework.HumanReadableSerializer
4.0.10
Prefix Reserved
dotnet add package Meziantou.Framework.HumanReadableSerializer --version 4.0.10
NuGet\Install-Package Meziantou.Framework.HumanReadableSerializer -Version 4.0.10
<PackageReference Include="Meziantou.Framework.HumanReadableSerializer" Version="4.0.10" />
<PackageVersion Include="Meziantou.Framework.HumanReadableSerializer" Version="4.0.10" />
<PackageReference Include="Meziantou.Framework.HumanReadableSerializer" />
paket add Meziantou.Framework.HumanReadableSerializer --version 4.0.10
#r "nuget: Meziantou.Framework.HumanReadableSerializer, 4.0.10"
#:package Meziantou.Framework.HumanReadableSerializer@4.0.10
#addin nuget:?package=Meziantou.Framework.HumanReadableSerializer&version=4.0.10
#tool nuget:?package=Meziantou.Framework.HumanReadableSerializer&version=4.0.10
Meziantou.Framework.HumanReadableSerializer
One-way serializer to an invariant human-readable format. You can use HumanReadableSerializer.Serialize (in the Meziantou.Framework.HumanReadable namespace) 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);
Lines are separated by \n on every platform, including line breaks inside multi-line values. Set NewLine = "\r\n" to use Windows line endings instead.
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, such as a User class with DisplayName and CreatedAt properties, 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 (3)
Showing the top 3 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 |
|
|
Meziantou.Framework.HumanReadableSerializer.Html
Formats the HTML values (text/html) serialized by Meziantou.Framework.HumanReadableSerializer, using the spec-compliant HTML parser of Meziantou.Framework.WebPlatform |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.10 | 202 | 10/21/2026 |
| 4.0.9 | 6,994 | 9/20/2026 |
| 4.0.8 | 1,697 | 9/15/2026 |
| 4.0.7 | 180 | 9/15/2026 |
| 4.0.6 | 265 | 9/15/2026 |
| 4.0.5 | 309 | 9/13/2026 |
| 4.0.4 | 1,022 | 9/6/2026 |
| 4.0.3 | 343 | 9/3/2026 |
| 4.0.2 | 3,110 | 8/23/2026 |
| 4.0.1 | 1,320 | 8/16/2026 |
| 4.0.0 | 6,742 | 7/5/2026 |
| 3.0.6 | 605 | 7/5/2026 |
| 3.0.5 | 4,237 | 6/13/2026 |
| 3.0.4 | 184 | 6/13/2026 |
| 3.0.3 | 4,691 | 5/31/2026 |
| 3.0.2 | 792 | 5/23/2026 |
| 3.0.1 | 1,894 | 5/14/2026 |
| 3.0.0 | 2,949 | 5/6/2026 |
| 2.4.22 | 4,338 | 4/25/2026 |
| 2.4.21 | 8,397 | 3/29/2026 |