YamlDotNet 16.3.0

Prefix Reserved
dotnet add package YamlDotNet --version 16.3.0
                    
NuGet\Install-Package YamlDotNet -Version 16.3.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="YamlDotNet" Version="16.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="YamlDotNet" Version="16.3.0" />
                    
Directory.Packages.props
<PackageReference Include="YamlDotNet" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add YamlDotNet --version 16.3.0
                    
#r "nuget: YamlDotNet, 16.3.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=YamlDotNet&version=16.3.0
                    
Install YamlDotNet as a Cake Addin
#tool nuget:?package=YamlDotNet&version=16.3.0
                    
Install YamlDotNet as a Cake Tool

YamlDotNet

Appveyor NuGet
Build status NuGet

YamlDotNet is a YAML library for netstandard and other .NET runtimes.

YamlDotNet provides low level parsing and emitting of YAML as well as a high level object model similar to XmlDocument. A serialization library is also included that allows to read and write objects from and to YAML streams.

YamlDotNet's conformance with YAML specifications:

YAML Spec YDN Parser YDN Emitter
v1.1
v1.2

What is YAML?

YAML, which stands for "YAML Ain't Markup Language", is described as "a human friendly data serialization standard for all programming languages". Like XML, it allows to represent about any kind of data in a portable, platform-independent format. Unlike XML, it is "human friendly", which means that it is easy for a human to read or produce a valid YAML document.

The YamlDotNet library

The library has now been successfully used in multiple projects and is considered fairly stable. It is compatible with the following runtimes:

  • netstandard 2.0
  • netstandard 2.1
  • .NET 6.0
  • .NET 8.0
  • .NET Framework 4.7

Quick start

Here are some quick samples to get you started which can be viewed in this fiddle.

Serialization from an object to a string

using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;
...

 var person = new Person
{
    Name = "Abe Lincoln",
    Age = 25,
    HeightInInches = 6f + 4f / 12f,
    Addresses = new Dictionary<string, Address>{
        { "home", new  Address() {
                Street = "2720  Sundown Lane",
                City = "Kentucketsville",
                State = "Calousiyorkida",
                Zip = "99978",
            }},
        { "work", new  Address() {
                Street = "1600 Pennsylvania Avenue NW",
                City = "Washington",
                State = "District of Columbia",
                Zip = "20500",
            }},
    }
};

var serializer = new SerializerBuilder()
    .WithNamingConvention(CamelCaseNamingConvention.Instance)
    .Build();
var yaml = serializer.Serialize(person);
System.Console.WriteLine(yaml);
// Output: 
// name: Abe Lincoln
// age: 25
// heightInInches: 6.3333334922790527
// addresses:
//   home:
//     street: 2720  Sundown Lane
//     city: Kentucketsville
//     state: Calousiyorkida
//     zip: 99978
//   work:
//     street: 1600 Pennsylvania Avenue NW
//     city: Washington
//     state: District of Columbia
//     zip: 20500

Deserialization from a string to an object

using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;
...

var yml = @"
name: George Washington
age: 89
height_in_inches: 5.75
addresses:
  home:
    street: 400 Mockingbird Lane
    city: Louaryland
    state: Hawidaho
    zip: 99970
";

var deserializer = new DeserializerBuilder()
    .WithNamingConvention(UnderscoredNamingConvention.Instance)  // see height_in_inches in sample yml 
    .Build();

//yml contains a string containing your YAML
var p = deserializer.Deserialize<Person>(yml);
var h = p.Addresses["home"];
System.Console.WriteLine($"{p.Name} is {p.Age} years old and lives at {h.Street} in {h.City}, {h.State}.");
// Output:
// George Washington is 89 years old and lives at 400 Mockingbird Lane in Louaryland, Hawidaho.

More information

More information can be found in the project's wiki.

Installing

Just install the YamlDotNet NuGet package:

PM> Install-Package YamlDotNet

If you do not want to use NuGet, you can download binaries here.

YamlDotNet is also available on the Unity Asset Store.

Contributing

Please read CONTRIBUTING.md for guidelines.

Release notes

Please see the Releases at https://github.com/aaubry/YamlDotNet/releases

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 is compatible.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.7

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net6.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (856)

Showing the top 5 NuGet packages that depend on YamlDotNet:

Package Downloads
KubernetesClient

Client library for the Kubernetes open source container orchestrator.

NJsonSchema.Yaml

JSON Schema reader, generator and validator for .NET

KubernetesClient.Models

Client library for the Kubernetes open source container orchestrator.

NetEscapades.Configuration.Yaml

YAML configuration provider implementation to use with Microsoft.Extensions.Configuration.

RamlToOpenApiConverter

Convert RAML file to Open API Specification

GitHub repositories (240)

Showing the top 20 popular GitHub repositories that depend on YamlDotNet:

Repository Stars
2dust/v2rayN
A GUI client for Windows, Linux and macOS, support Xray and sing-box and others
microsoft/semantic-kernel
Integrate cutting-edge LLM technology quickly and easily into your apps
bitwarden/server
Bitwarden infrastructure/backend (API, database, Docker, etc).
marticliment/UniGetUI
UniGetUI: The Graphical Interface for your package managers. Could be terribly described as a package manager manager to manage your package managers
Jackett/Jackett
API Support for your favorite torrent trackers
chocolatey/choco
Chocolatey - the package manager for Windows
JosefNemec/Playnite
Video game library manager with support for wide range of 3rd party libraries and game emulation support, providing one unified interface for your games.
unoplatform/uno
Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
dotnet/yarp
A toolkit for developing high-performance HTTP reverse proxy applications.
AutoDarkMode/Windows-Auto-Night-Mode
Automatically switches between the dark and light theme of Windows 10 and Windows 11
gitextensions/gitextensions
Git Extensions is a standalone UI tool for managing git repositories. It also integrates with Windows Explorer and Microsoft Visual Studio (2015/2017/2019).
Kareadita/Kavita
Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.
btcpayserver/btcpayserver
Accept Bitcoin payments. Free, open-source & self-hosted, Bitcoin payment processor.
ant-design-blazor/ant-design-blazor
🌈A rich set of enterprise-class UI components based on Ant Design and Blazor.
LykosAI/StabilityMatrix
Multi-Platform Package Manager for Stable Diffusion
kurrent-io/EventStore
EventStoreDB, the event-native database. Designed for Event Sourcing, Event-Driven, and Microservices architectures
dotnet/tye
Tye is a tool that makes developing, testing, and deploying microservices and distributed applications easier. Project Tye includes a local orchestrator to make developing microservices easier and the ability to deploy microservices to Kubernetes with minimal configuration.
2dust/clashN
A clash client for Windows, support Mihomo
Prowlarr/Prowlarr
Prowlarr is an indexer manager/proxy built on the popular *arr .net/reactjs base stack to integrate with your various PVR apps, supporting management of both Torrent Trackers and Usenet Indexers.
Azure/azure-powershell
Microsoft Azure PowerShell
Version Downloads Last updated
16.3.0 2,105,130 12/23/2024
16.2.1 1,066,516 12/1/2024
16.2.0 4,011,838 11/10/2024
16.1.3 1,843,894 9/26/2024
16.1.2 379,377 9/13/2024
16.1.1 3,773 9/13/2024
16.1.0 324,092 9/1/2024
16.0.0 4,544,245 7/14/2024
15.3.0 1,506,067 6/16/2024
15.1.6 548,679 5/29/2024
15.1.4 7,209,054 5/11/2024
15.1.2 3,598,887 2/26/2024
15.1.1 936,270 2/4/2024
15.1.0 4,792,609 1/23/2024
13.7.1 16,913,688 10/15/2023
13.7.0 112,822 10/10/2023
13.5.2 94,891 10/5/2023
13.5.1 45,607 10/5/2023
13.5.0 4,228 10/5/2023
13.4.0 1,233,847 9/20/2023
13.3.1 7,429,053 8/28/2023
13.2.0 594,874 8/14/2023
13.1.1 5,438,300 6/17/2023
13.1.0 2,394,865 4/16/2023
13.0.2 1,500,913 3/11/2023
13.0.1 6,216,674 2/19/2023
13.0.0 1,152,019 2/7/2023
12.3.1 8,390,235 12/19/2022
12.3.0 4,804 12/19/2022
12.2.1 248,077 12/14/2022
12.2.0 346,043 12/9/2022
12.1.0 622,639 12/5/2022
12.0.2 2,146,841 10/7/2022
12.0.1 8,172,642 9/17/2022
12.0.0 4,135,209 7/23/2022
11.2.1 83,519,133 6/28/2021
11.2.0 577,764 6/13/2021
11.1.3-nullable-enums-0003 40,717 4/9/2021
11.1.1 3,476,071 4/9/2021
11.1.0 34,128 4/8/2021
11.0.1 76,765 4/1/2021
10.1.0 73,790 3/31/2021
10.0.0 56,102 3/27/2021
9.1.4 8,507,167 1/15/2021
8.1.2 29,033,277 5/28/2020
8.1.0 12,998,847 1/18/2020
8.0.0 6,908,594 10/19/2019
7.0.0 731,104 9/28/2019
6.1.2 3,218,196 7/20/2019
6.1.1 626,653 6/4/2019
6.0.0 13,743,973 3/15/2019
5.4.0 416,011 2/12/2019
5.3.1 8,561 2/12/2019
5.3.0 1,426,884 12/5/2018
5.1.0 2,017,029 9/21/2018