SharpYaml is a .NET library for YAML compatible with CoreCLR
SharpYaml is a .NET library that provides a YAML parser and serialization engine for .NET objects, compatible with CoreCLR.
NOTICE:
This project is no longer actively maintained since 2016, but it's still accepting Pull-Requests.
Small improvements and fixes are welcome, but big refactoring won't likely be.
Please, open an issue in case you are not sure about the changes you want to bring before working on a PR.
var serializer = new Serializer();
var text = serializer.Serialize(new { List = new List<int>() { 1, 2, 3 }, Name = "Hello", Value = "World!" });
Console.WriteLine(text);
Output:
List:
- 1
- 2
- 3
Name: Hello
Value: World!
SharpYaml is a fork of YamlDotNet and is adding the following features:
.netstandard2.0
IYamlSerializable
for implementing custom serializers, along IYamlSerializableFactory
to allow dynamic creation of serializers. Registration can be done through SerializerSettings.RegisterSerializer
and SerializerSettings.RegisterSerializerFactory
ScalarSerializerBase
to provide custom serialization to/from a Yaml scalarITypeDescriptor
and IMemberDescriptor
SerializerSettings
(see usage)
SerializerSettings.Register(memberInfo, attribute)
EmitAlias
, IndentLess
, SortKeyForMapping
, EmitJsonComptible
, EmitCapacityForList
, LimitPrimitiveFlowSequence
, EmitDefaultValues
SerializerSettings.DefaultStyle
and SerializerSettings.DynamicStyleFormat
SerializerSettings.RegisterAssembly
IObjectSerializerBackend
that allows to hook a global rewriting for all YAML serialization types (scalar, sequence, mapping) when serializing/deserializing to/from a .NET type.MIT