Table of Contents

Built-in converters

The following types have explicit support built into the library because they are primitives or complex.

Most other types build on this list and will typically default to "Just Work" with this library without additional attributes.

Although these types have built-in support, a type shape is always required for the top-level type being serialized.

Enums, arrays and various dictionary types that utilize these types are implicitly supported, provided the type shape provider can produce shapes for them.

Numbers

Text

Time

Other

Optional converters

A number of optional converters are included but not active by default in order to keep the size of your application small and startup fast. You can activate these converters in code when you need them using the extension methods on OptionalConverters.

Data type API to enable
ExpandoObject WithExpandoObjectConverter
object WithObjectConverter or WithDynamicObjectConverter
JsonNode WithSystemTextJsonConverters
JsonElement WithSystemTextJsonConverters
JsonDocument WithSystemTextJsonConverters

For example, use this code to create a msgpack serializer that can convert System.Text.Json DOM types:

private static readonly MessagePackSerializer Serializer = new MessagePackSerializer()
    .WithSystemTextJsonConverters();

Then use the serializer stored in that field to serialize and deserialize such objects.

String-based Guid serialization

By default, Guid values are serialized in a compact binary format for maximum efficiency. If you prefer to serialize GUIDs as strings (for human readability or compatibility), you can use WithGuidConverter to specify the string format.