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

YamlDotNet: How to handle !!set

I am trying to deserialize some YAML that has !!set in a string created by SnakeYaml when serializing Java HashSet. Different generic types are serialized, for example HashSet and with custom type HashSet. Example YAML: holidays: !!set ?…
Chill
  • 77
  • 11
1
vote
1 answer

Handle Double.NaN from Java to C# using snakeyaml (Java) and YamlDotNet (C#)

I'm using YAML to communicate between C# GUI and server side Java, which is working fine in general. However, if I pass a field that is a Double and the value is Double.NaN on Java side the Yaml passes as ".NaN", and when I come to deserialize on…
Chill
  • 77
  • 11
1
vote
1 answer

Numeric values in YamlDotNet.RepresentationModel

How do I get numeric values from the RepresentationModel? Say, after traversing a document, I have a YamlScalarNode. It has a string Value, which I can, of course, try to convert to a number, but I'd expect YAML to detect the type and present it as…
Zeus
  • 1,052
  • 1
  • 9
  • 18
1
vote
2 answers

Ignore member of base class in YamlDotNet

I have a class which I want to serialize with YamlDotNet: public class AwesomeClass : PropertyChangedBase { private bool _element1; private bool _enabled; public bool Element1 { get { return _element1; } set …
Pumper
  • 233
  • 1
  • 6
  • 11
1
vote
1 answer

How to serialize a custom class with YamlDotNet

I'm trying to serialize a custom class with YamlDotNet library. Here is my class: public class Person { string firstName; string lastName; public Person(string first, string last) { firstName = first; lastName =…
YohDono
  • 25
  • 1
  • 7
1
vote
1 answer

Get real bool value from YamlStream

I use YamlDotnet to parse a yaml stream to a dictionary of string object via the YamlStream. The YamlMappingType, YamlSequenceNode and YamlScalarNode are used in order to convert the value to a dictionary, a list or a string. But I need to get a…
Jérémie Bertrand
  • 3,025
  • 3
  • 44
  • 53
1
vote
1 answer

YAML Lazy Reading of Stream

I am using the YAMLDotNet library, and was trying to have a YamlVisitor class fire its events as it would when it reaches the beginning and end of each node type. This would work fine if the stream is a StreamReader that uses a file or a string,…
K. R.
  • 1,220
  • 17
  • 20
1
vote
1 answer

YamlDotNet does not properly deserialize double word unicode characters

I'm working on a twitter text c# library and twitter has added a double word unicode character test to their conformance tests. https://github.com/twitter/twitter-text-conformance/blob/master/validate.yml Here's an nUnit test method to run against…
Mark Evaul
  • 653
  • 5
  • 11
1
vote
1 answer

How to manually deserialize a scalar value?

I am traversing through a Yaml file and want to deserialize the string saved in Value of YamlScalarNode to a dotnet type. I could not find a Convert Method in YamlScalarNode. There must be a converter in the project which regards the yaml…
rudimenter
  • 3,242
  • 4
  • 33
  • 46
0
votes
1 answer

Can't deserialize list with anchor YamlDotNet

I think this might be a problem with YamlDotNet but that does seem somewhat unlikely given that it's quite a well used library so figured I'd ask. I have this bit of yaml: Methods: - Name: "AddPgfPlotWithAxes" Arguments: - Name:…
ScottishTapWater
  • 3,656
  • 4
  • 38
  • 81
0
votes
0 answers

How to have the `INamingConvention` passed into a custom value converter?

I wrote a custom value converter for YamlDotNet. I initialize it like this: var ser = new SerializerBuilder().WithNamingConvention(UnderscoredNamingConvention.Instance).WithTypeConverter(MyTypeConverter.Instance).Build(); How to get the naming…
rabejens
  • 7,594
  • 11
  • 56
  • 104
0
votes
1 answer

Jschema Validation not validating Array Objects when they are declared using $ref in the schema

JSON Schema validation is not validating Array items when items are declared using $ref in the Schema. It allows additional properties in the object which are not present in the schema although additionalProperties is set to False in the root schema…
0
votes
0 answers

How to set meaningful names for anchor tags during Yaml serialization using YamlDotNet library in C#?

Set anchor tag name during serialization using YamlDotNet library. I am using YAMLDotNet to serialize object to Yaml. I am using XML file and generating YAML out of it using YamlDotNet. The YAML that gets generated has anchor tags however, the name…
0
votes
1 answer

YamlDotNet doesn't support deserializing KeyValuePair<,> types

I've got a scenario in which I need to deserialize a sequence of maps to IEnumerable> that wouldn't be solved by simply using Dictionary instead. Since, apparently, YamlDotNet doesn't support…
Salih Kavaf
  • 897
  • 9
  • 17
0
votes
1 answer

YamlDotNet apparently does not use NamingConvention during deserialization

I'm sure I'm getting things wrong, since it is widely used, but this test fails for me: using YamlDotNet.Serialization; using YamlDotNet.Serialization.NamingConventions; class Test { public int Value { get; set; } } …
Felice Pollano
  • 32,832
  • 9
  • 75
  • 115