Meziantou.Framework.HumanReadableSerializer 1.0.5

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Meziantou.Framework.HumanReadableSerializer --version 1.0.5                
NuGet\Install-Package Meziantou.Framework.HumanReadableSerializer -Version 1.0.5                
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="Meziantou.Framework.HumanReadableSerializer" Version="1.0.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Meziantou.Framework.HumanReadableSerializer --version 1.0.5                
#r "nuget: Meziantou.Framework.HumanReadableSerializer, 1.0.5"                
#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.
// Install Meziantou.Framework.HumanReadableSerializer as a Cake Addin
#addin nuget:?package=Meziantou.Framework.HumanReadableSerializer&version=1.0.5

// Install Meziantou.Framework.HumanReadableSerializer as a Cake Tool
#tool nuget:?package=Meziantou.Framework.HumanReadableSerializer&version=1.0.5                

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());
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 is compatible.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Meziantou.Framework.HumanReadableSerializer:

Package Downloads
Meziantou.Framework.InlineSnapshotTesting

Enables verification of objects using inline snapshots

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.4.0 4,081 12/17/2024
2.3.0 67 12/17/2024
2.2.1 398 11/22/2024
2.2.0 137 11/20/2024
2.1.1 110 11/17/2024
2.1.0 7,260 10/28/2024
2.0.0 400 10/27/2024
1.0.20 4,012 9/23/2024
1.0.19 32,602 12/29/2023
1.0.18 8,248 11/15/2023
1.0.17 347 9/29/2023
1.0.16 205 9/29/2023
1.0.15 493 7/18/2023
1.0.14 255 7/10/2023
1.0.13 507 5/31/2023
1.0.11 204 5/31/2023
1.0.10 260 5/30/2023
1.0.9 205 5/27/2023
1.0.8 307 5/25/2023
1.0.7 232 5/24/2023
1.0.5 454 4/21/2023
1.0.4 284 4/12/2023
1.0.3 289 4/1/2023
1.0.2 409 3/21/2023
1.0.1 307 3/19/2023
1.0.0 221 3/18/2023