Code Monkey home page Code Monkey logo

sharpyaml's Introduction

SharpYaml Build status NuGet

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

Usage

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!

Features

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+ (CoreCLR)
  • 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.

Download

SharpYaml is available on NuGet

License

MIT

sharpyaml's People

Contributors

aaubry avatar bf-sharris avatar daniel15 avatar johshoff avatar kryptos-fr avatar martindevans avatar maxvoxel8 avatar pathogendavid avatar peterdavidson avatar roji avatar turee avatar xen2 avatar xoofx avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.