Questions tagged [yamldotnet]

YamlDotNet is a .NET library for YAML

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.

The most up-to-date version can always be found right from Visual studio by installing following NuGet package - YamlDotNet.

PM> Install-Package YamlDotNet

Documentation can be found on the official page.

188 questions
1
vote
1 answer

Serializing with Yaml IEnumerable class results in weird output

The type getting deserialized/ serialized is (some parts are excluded): public class Entry : IEnumerable{ public string name { get; set; } public List items { get; set; } public Entry() { } public IEnumerator
PizzaPie
  • 13
  • 3
1
vote
0 answers

Unable to compile YamlDotNet csproj

I've cloned the official YamlDotNet git repository. https://github.com/aaubry/YamlDotNet However I'm unable to compile the solution Failed in Visual Studio 2017 Failed using the build.ps1 script in the repo I get the same error. Predefined type…
manni
  • 103
  • 7
1
vote
1 answer

Issue Serializing Type Tags from YamlStream

I am having an issue creating a config file for a class that includes a list of objects that implement the same interface when I use the YamlStream API. I want to preserve the local tags that I put on list items so that they can be deserialized…
1
vote
1 answer

How to switch from YAML array to mapping?

I'm trying to serialize a list of custom objects in YAML with YAMLDOTNET and I've the following result : fruits: - berry: size: 5 - banana: size: 6 - coconut: size: 10 Could you tell me how could I have the following result ? fruits: …
Steezix
  • 28
  • 6
1
vote
1 answer

YamlDotNet "Expected 'StreamEnd', got 'DocumentStart'"when reading string

I'm using YamlDotNet with an Azure Function v2 to serialise YAML from a markdown file (hosted on GitHub) to a .net object. I'm struggling with this error when attempting to deserialize the YAML string Expected 'StreamEnd', got 'DocumentStart I'm…
Martin Kearn
  • 2,313
  • 1
  • 21
  • 35
1
vote
1 answer

Deserialize Yaml into c# collection

I have the following yaml structure: TestPaySignService: Test: TestString: settings-key: TestStringValue types: - type1 - type2 TestString2: settings-key:…
David Maisuradze
  • 824
  • 2
  • 12
  • 27
1
vote
0 answers

yamldotnet merge 2 yaml files (deep merge function)

is there a simple way in the library to deep merge 2 yaml files ? I found this question : Does C# YamlDotNet library support the merge key? but it mean I need to convert my yaml file to yaml merge syntax ?
Dragouf
  • 4,676
  • 4
  • 48
  • 55
1
vote
0 answers

Deserializing custom types

The below xaml loosely describes a number of steps that can be re-arranged into many different configurations, and nested levels. --- sequence: - manual: desc: unpack baloons - electric: desc: inflate each balloon - parallel: -…
Alex N
  • 46
  • 4
1
vote
0 answers

Deserializing yaml in C#

I have a series of yaml files with a poorly implemented structure that I need to parse in C#. The schema resembles: Root: KnownTypeA: VariableNameLevel3A: VariableNameLevel4A: KnownTypeAPropertyA: Bar …
Ritmo2k
  • 993
  • 6
  • 17
1
vote
0 answers

Deserialize MkDocs.yml pages object with YamlDotNet

I am working on a project to convert multiple document sources to a MkDocs project. The MkDocs project file, MkDocs.yml, is a YAML document. I need to deserialize the existing pages so I can insert new .md pages and titles in that project through…
M. Medlin
  • 11
  • 1
1
vote
1 answer

Deserializing Yaml into c# object

I just started working with Yaml and would really appreciate some input. I am creating a YAML and trying to deserailize it to existing C# class. Existing C# class: [System.Xml.Serialization.XmlIncludeAttribute(typeof(FooType))] public…
anon
  • 367
  • 1
  • 4
  • 18
1
vote
1 answer

Deserialize nested YAML using YamlDotNEt and custom type class in c#

I have been going around this for a few days and just can't get this working. I have a YAML file that follows the following format (Note I can't change the delivery format as it's external). I have picked a random topic but the structure is the…
1
vote
1 answer

Accessing key from YamlDotNet deserializer

I'm trying to deserialize a YAML file from a source that I don't control where some of the files have numerical keys. Example: 0: name: Category1 published: true 1: name: Category2 published: false For my purposes, the numerical key…
W Anders
  • 13
  • 6
1
vote
1 answer

YamlDotNet specify main parent for serialization?

I have a Planet class which contains a list of tiles. Each tile also has a list of neighbouring tiles. In some way all tiles are connected (indirectly). Now I'm trying to serialize this with YamlDotNet. What happens however is that I get a very ugly…
The Oddler
  • 6,314
  • 7
  • 51
  • 94
1
vote
1 answer

How to preserve doublequotes + prevent weird numbers in YAML output

My app is loading and analyzing a nested YAML file, extracting each single Key/Value pair with the RepresentationModel. Some Values will be changed, then I write back the YAML file. Input file is: account: menu: dev: "Device Settings" # Item…
Hanibani
  • 11
  • 2