Meziantou.Framework.HumanReadableSerializer 1.0.9

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.9                
NuGet\Install-Package Meziantou.Framework.HumanReadableSerializer -Version 1.0.9                
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.9" />                
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.9                
#r "nuget: Meziantou.Framework.HumanReadableSerializer, 1.0.9"                
#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.9

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

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.2.1 164 11/22/2024
2.2.0 119 11/20/2024
2.1.1 97 11/17/2024
2.1.0 4,877 10/28/2024
2.0.0 390 10/27/2024
1.0.20 3,869 9/23/2024
1.0.19 32,555 12/29/2023
1.0.18 8,242 11/15/2023
1.0.17 343 9/29/2023
1.0.16 201 9/29/2023
1.0.15 489 7/18/2023
1.0.14 250 7/10/2023
1.0.13 503 5/31/2023
1.0.11 200 5/31/2023
1.0.10 256 5/30/2023
1.0.9 201 5/27/2023
1.0.8 301 5/25/2023
1.0.7 228 5/24/2023
1.0.5 450 4/21/2023
1.0.4 280 4/12/2023
1.0.3 285 4/1/2023
1.0.2 405 3/21/2023
1.0.1 303 3/19/2023
1.0.0 216 3/18/2023