Table of Contents

Getting Started

Installation

Consume this ShapeShift via its NuGet Package. Click on the badge to find its latest version and the instructions for consuming it that best apply to your project.

ShapeShift NuGet package
ShapeShift.Json NuGet package
ShapeShift.MsgPack NuGet package
ShapeShift.Cbor NuGet package
ShapeShift.Yaml NuGet package
ShapeShift.Taml NuGet package

Usage

Pick a format package, annotate the types you serialize with PolyType's GenerateShapeAttribute, and create a serializer:

var serializer = new JsonSerializer
{
    PropertyNamingPolicy = ShapeShiftNamingPolicy.CamelCase,
    Indented = true,
};

var person = new Person("Ada", ["mathematics", "programming"]);
string json = serializer.Serialize(person);
Person? copy = serializer.Deserialize<Person>(json);

From there:

  • Features surveys what every format shares.
  • Customizing the core covers immutable serializer configuration, the naming, default-value, strictness, and security policies, and custom converters and converter factories.
  • JSON, MessagePack, and CBOR document the format-specific APIs and wire representations.
  • Authoring a format package explains how to add a format of your own.