YamlMap 1.5.0-RC05

This is a prerelease version of YamlMap.
dotnet add package YamlMap --version 1.5.0-RC05
                    
NuGet\Install-Package YamlMap -Version 1.5.0-RC05
                    
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="YamlMap" Version="1.5.0-RC05" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="YamlMap" Version="1.5.0-RC05" />
                    
Directory.Packages.props
<PackageReference Include="YamlMap" />
                    
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 YamlMap --version 1.5.0-RC05
                    
#r "nuget: YamlMap, 1.5.0-RC05"
                    
#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.
#:package YamlMap@1.5.0-RC05
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=YamlMap&version=1.5.0-RC05&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=YamlMap&version=1.5.0-RC05&prerelease
                    
Install as a Cake Tool

YamlMap

Build status Build status

NuGet Version NuGet Version

Codacy Badge

A .NET Yaml Parser.
Map Yaml to .NET objects and vice versa.

Usage

Deserialize a yaml string to an object

// Read a file using a YamlFileReader
var reader = new YamlFileReader();
var item = reader.Read<Item>(filepath);

// or

// Read a string using the YamlReader
var reader = new YamlReader();
var item = reader.Read<Item>(yaml);

// or

// Read a string using the static Serializer
var item = Serializer.Deserialize<Item>(yaml);

Serialize an object to a yaml string

// Write a file using a YamFilelWriter
var writer = new YamlFileWriter();
writer.Write(filepath, item);

// or

// Serialize an object to a string using a YamlWriter
var writer = new YamlWriter();
writer.Write(item);

// or

// serialize an object to string using the static Serializer
var yml = Serializer.Serialize(item);

Implemented serialization features

  • Reading YAML strings to Tokens
  • Deserializing YAML string to a POCO
  • Writing Tokens to YAML
  • Serializing POCO to YAML

Implemented YAML features

Comments

# This is a comment

Properties

Property: Value

Objects

User:
  name: John Smith
  age: 33

Lists

Movies:
  - Casablanca
  - Spellbound
  - Notorious

Inline Lists

Movies: [Casablanca, Spellbound, Notorious]

Multiline Lists

Movies: [Casablanca, 
   Spellbound, Notorious]

Quotations

Movies: "Casablanca, Spellbound, Notorious"
Drive: 'c: is a drive'

Block statements (multiline strings)

Text: |
  There was a young fellow of Warwick
  Who had reason for feeling euphoric
      For he could, by election
      Have triune erection
  Ionic, Corinthian, and Doric
WrappedText: >
  Wrapped text
  will be folded
  into a single
  paragraph

  Blank lines denote
  paragraph breaks

Pitfalls with Plain flow scalars:

  • Colons (:) can be contained in a string, but are not allowed before a space or newline

Not yet implemented YAML Features

Blocks

--- 

Inline Objects

User: {name: John Smith, age: 33}

Block statements with strip or keep newlines at end

Text: |+
  There was a young fellow of Warwick
  
Text: |-
  There was a young fellow of Warwick
  
WrappedText: >+
  Wrapped text
  
WrappedText: >-
  Wrapped text
  

Best practice

Deserializng yaml to a Object

To deserialize a Yaml to a object, it is best to have a parameterless constructor.
If a object needs to have a constructor with parameters, the parameter names have to be the same as the properties that they are mapped to.
Else YamlMap will not be able to map the correct values to the parameters.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  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.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.5.0-RC05 594 9/18/2025
1.4.1 337 9/1/2025
1.4.0 246 8/20/2025
1.3.0 825 3/15/2023
1.2.4 639 9/26/2022
1.2.3 548 8/29/2022
1.2.2 527 8/29/2022
1.2.1 569 12/9/2021
1.2.0 415 12/2/2021
1.1.0 417 11/30/2021