Skip to content
Branch: master
Go to file

Latest commit

xoofx committed 898758f Jun 25, 2020
Fix clearing of mapping/sequence, and update IsImplicit when setting Tag.


Failed to load latest commit information.

SharpYaml Build Status NuGet

SharpYaml is a .NET library that provides a YAML parser and serialization engine for .NET objects, compatible with CoreCLR.


var serializer = new Serializer();
var text = serializer.Serialize(new { List = new List<int>() { 1, 2, 3 }, Name = "Hello", Value = "World!" });


  - 1
  - 2
  - 3
Name: Hello
Value: World!


SharpYaml is a fork of YamlDotNet and is adding the following features:

  • Supports for multiple .NET frameworks:
    • .NET 3.5
    • .NET PCL Profile 328 (portable-net40+sl5+win8+wpa81+wp8)
    • .NET 4.5+
    • .NET Standard 1.3+ and .NET Standard 2.0+
  • Memory allocation and GC pressure improved
  • Completely rewritten serialization/deserialization engine
  • A single interface IYamlSerializable for implementing custom serializers, along IYamlSerializableFactory to allow dynamic creation of serializers. Registration can be done through SerializerSettings.RegisterSerializer and SerializerSettings.RegisterSerializerFactory
    • Can inherit from ScalarSerializerBase to provide custom serialization to/from a Yaml scalar
  • Supports for custom collection that contains user properties to serialize along the collection.
  • Supports for Yaml 1.2 schemas
  • A centralized type system through ITypeDescriptor and IMemberDescriptor
  • Highly configurable serialization using SerializerSettings (see usage)
    • Add supports to register custom attributes on external objects (objects that you can't modify) by using SerializerSettings.Register(memberInfo, attribute)
    • Several options and settings: EmitAlias, IndentLess, SortKeyForMapping, EmitJsonComptible, EmitCapacityForList, LimitPrimitiveFlowSequence, EmitDefaultValues
    • Add supports for overriding the Yaml style of serialization (block or flow) with SerializerSettings.DefaultStyle and SerializerSettings.DynamicStyleFormat
  • Supports for registering an assembly when discovering types to deserialize through SerializerSettings.RegisterAssembly
  • Supports a IObjectSerializerBackend that allows to hook a global rewriting for all YAML serialization types (scalar, sequence, mapping) when serializing/deserializing to/from a .NET type.


SharpYaml is available on NuGet



You can’t perform that action at this time.