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
2
votes
1 answer

YamlDotNet - Serialization of Guid properties generates empty brackets

I am using YamlDotNet library to serialize some objects in Yaml. I've met some problems with the serialization of Guid properties. Serialization of Guid properties generates empty brackets ( ex: {} ) See code below Dim l As New List(Of…
Kristofen44
  • 118
  • 1
  • 10
1
vote
1 answer

c# yamldotnet deserialize scalar or sequence in yaml dynamically

I am using YamlDotNet library, and I wanted to deserialize the 1000s of Yaml file using a common data structure class. Sample class have given below. The class Jobs contains a filed Pool which can be scalar or sequence. Like it can be string or…
Saurabh Raoot
  • 1,303
  • 3
  • 26
  • 31
1
vote
2 answers

How do I specify the date locale when Dserializing YAML using YamlDotNet?

In a YAML document, I've got a date formatted using an EN-GB locale (so 07/02/2019 is 2nd February 2019) When I deserialize the document using YamlDotNet, it interprets this as an EN-US date so it stores it as July 2nd 2019 # Date in…
Jake
  • 1,701
  • 3
  • 23
  • 44
1
vote
1 answer

How can I apply YamlDotNet ScalarStyle.SingleQuoted to the string property within a List?

I'm using YamlDotNet to serialize an object like this using System.Collections.Generic; using YamlDotNet.Core; using YamlDotNet.Serialization; public class Thing { [YamlMember(ScalarStyle = ScalarStyle.SingleQuoted)] public string Name …
Zee
  • 1,780
  • 3
  • 16
  • 27
1
vote
1 answer

Can YamlDotNet Deserialize to an dynamic object graph?

I have a large YAML document that I want to deserialize to a dynamic object (ExpandoObject). Can YamlDotNet deserialize directly to a dynamic object tree? I can get there by going to Json first and then using NewtonSoft to deserialize to an…
dkackman
  • 15,179
  • 13
  • 69
  • 123
1
vote
1 answer

How to handle cycles in object graph with yamldotnet serializers

I'm trying to use Yamldotnet library to serialize a model with circular references. Which serializer settings or data class attributes should I use to achieve this? I want to be able to serialize and deserialize the models back, keeping…
1
vote
1 answer

Error deserializing yaml with yamldotnet - Property not found

I'm using C#, YamlDotNet and following the example: How to deserialize YAML with YAMLDotNet? But I'm getting the follow error: Exception thrown: 'YamlDotNet.Core.YamlException' in YamlDotNet.dll YamlDotNet.Core.YamlException: (Line: 1, Col: 1, Idx:…
Mário Cera
  • 25
  • 1
  • 5
1
vote
1 answer

How to serialize a YamlNode graph?

YamlDotNet seems to support serializing POC graphs, but I can't find an API that serializes an object graph made directly of YamlNode types. Is there a way to do this?
Andrew Arnott
  • 80,040
  • 26
  • 132
  • 171
1
vote
1 answer

Why isn't content written to yaml document?

My intention is to write an array of Items in a yaml file, format should be like this: - country: Denmark city: Copenhagen - country: Italy city: Rome So I wrote this method: public static void Write(MyItem myItem) { var myFilePath =…
Sami
  • 393
  • 8
  • 22
1
vote
1 answer

How to add content to existing remotely located yaml file within Runspace C#

We can read yaml file within Runspace using code given in below post How to read remote yaml file present in Azure VM from local machine using C# Runspace But how to update existing remotely located yaml file. I want to use code using YamlDotnet…
S.Chandra Sekhar
  • 453
  • 3
  • 11
  • 22
1
vote
1 answer

Reading Yamldotnet with c#

i've some problems when i'm trying to read a Yaml file using c# and need help to finish this task , how can i read a such Yaml file into variables so i can treat them . FileConfig: sourceFolder: /home destinationFolder:…
Totti10
  • 13
  • 1
  • 3
1
vote
1 answer

How do I deserialize a cloudformation template yaml into a C# Dictionary of Strings?

I need my csharp app to read a cloudformation template yaml file (with !Sub and other functions) in order to copy the resource, as-is, into another cloudformation template yaml with a different resource name. The YamlDotNet fails to deserialize when…
Chip
  • 1,439
  • 3
  • 15
  • 29
1
vote
1 answer

Deserialize YAML

I'm trying, what I think, a very simple operation but I can't wrap my head around the exception I'm getting. Basically it's a copy of the Samples.DeserializeObjectGraph example in YamlDotNet:…
Jon
  • 322
  • 1
  • 11
1
vote
1 answer

Is it possible to remove a YamlNode from a YamlDocument

I'm looking to implement an extension method similar to this: public static bool RemoveNode(this YamlDocument doc, YamlNode node) { } Basically, I have a YamlDocument, and a YamlNode I would like to remove from that document. Neither YamlDocument…
Mike Christensen
  • 88,082
  • 50
  • 208
  • 326
1
vote
0 answers

Is there a way to treat sequences as single mappings in yamldotnet?

I have a third party YAML data that I need to deserialize modify then serialize and send back. The problem being that their data is formatted so every entry is its own sequence. I was able to come up with a type converter that will serialize the…
Gishe
  • 39
  • 3