Dumpy.Html 1.1.1

dotnet add package Dumpy.Html --version 1.1.1
                    
NuGet\Install-Package Dumpy.Html -Version 1.1.1
                    
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="Dumpy.Html" Version="1.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Dumpy.Html" Version="1.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Dumpy.Html" />
                    
Project file
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 Dumpy.Html --version 1.1.1
                    
#r "nuget: Dumpy.Html, 1.1.1"
                    
#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 Dumpy.Html@1.1.1
                    
#: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=Dumpy.Html&version=1.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Dumpy.Html&version=1.1.1
                    
Install as a Cake Tool

Dumpy.Html

Generate compact, structured HTML representations of objects for user reports, debugging, logging artifacts, or sharing in docs and bug reports.

Supports: netstandard2.1, net6.0 and later

Installation

.NET CLI

dotnet add package Dumpy.Html

Package Manager

Install-Package Dumpy.Html

PackageReference


<ItemGroup>
    <PackageReference Include="Dumpy.Html" Version="1.0.0"/>
</ItemGroup>

Quick start

Dump any object to HTML
using Dumpy.Html;

var person = new { Name = "Ada", Age = 37 };
string html = person.Dump();
// Save or embed the HTML
System.IO.File.WriteAllText("person.html", html);
Customize rendering via options
using Dumpy;
using Dumpy.Html;

var options = new HtmlDumpOptions
{
    MaxDepth = 6,
    ReferenceLoopHandling = ReferenceLoopHandling.IgnoreAndSerializeCyclicReference,
    AddTitleAttributes = true,
    CssClasses = new CssClassOptions
    {
        Enabled = true,
        Null = "null-element",
    }
};

string html = person.Dump(options);

Options

Default options:

new HtmlDumpOptions
{
    // Choose what to do with cyclic references, options: 
    // Error, Ignore, IgnoreAndSerializeCyclicReference, Serialize
    ReferenceLoopHandling = ReferenceLoopHandling.Error,

    // Limit traversal depth to avoid overly deep graphs.
    MaxDepth = 10,

    // Limit the number of items to dump from a collection. Set if you dump large lists, arrays...etc.
    MaxCollectionItems = int.MaxValue,

    // Whether to include dump instance fields.
    IncludeFields = false,

    // Whether to include non public properties and fields.
    IncludeNonPublicMembers = false,

    // Filter which member (property of field) will be included in the output.
    MemberFilter = m => true,

    // Register custom HtmlConverter instances to control how specific types are rendered.
    Converters = { new MyHtmlConverter() },

    // Add HTML title attributes containing additional metadata (ex. type name).
    AddTitleAttributes = false,

    // Control CSS classes applied to generated HTML.
    CssClasses = new CssClassOptions
    {
        Enabled = true,                         // Disable to stop emitting CSS classes
        Null = "dm-null",                       // Added to null values
        EmptyCollection = "dm-empty",           // Added to empty collections (arrays, dictionaries, tuples...etc)
        CyclicReference = "dm-cyclic",          // Added to generated cyclic reference elements
        MaxDepthReached = "dm-depth-max",       // Added to generated max depth reached elements
        TableInfoHeader = "dm-t-info",          // Added to the info row of a table
        TableDataHeader = "dm-t-data",          // Added to the header rowo the table
    },
}

API overview

The main utility class is the HtmlDumper static class, which provides the following extension methods.

// Dumps the value to an HTML string. The second one lets you specify the runtime type.
string DumpHtml<T>(this T value, HtmlDumpOptions? options = null)
string DumpHtml<T>(this T value, Type valueType, HtmlDumpOptions? options = null)

// Low-level API that writes directly to a ValueStringBuilder (advanced)
void DumpHtml<T>(ref ValueStringBuilder writer, T? value, Type valueType, HtmlDumpOptions options)

Usage

Dump to an HTML string and save it:

var html = person.Dump();
System.IO.File.WriteAllText("person.html", html);

Specify the runtime type explicitly:

Employee employee = person;
var html = employee.Dump(typeof(Person));

Supported types

You can dump almost any .NET object or value, including:

  • Primitives, anonymous types, POCOs
  • Enumerables and collections (including multidimensional arrays)
  • Tuples and ValueTuples
  • DataTable and DataSet
  • JsonDocuments and JsonElements
  • XmlNodes and XNodes

Custom converters

To add your own converter, create an HtmlConverter or a factory and register it via HtmlDumpOptions.Converters

var options = new HtmlDumpOptions();
options.Converters.Add(new MyCustomTypeHtmlConverter());
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.  net9.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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

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.1 200 10/26/2025
1.1.0 121 10/25/2025
1.0.0 193 10/22/2025