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

What does a single exclamation mark do in YAML?

I'm working with the YamlDotNet library and I'm getting this error when loading a YAML file: While parsing a tag, did not find expected tag URI. The YAML file is supposed to be well-formed because it comes right from RoR. The error seems to be…
Dario Solera
  • 5,694
  • 3
  • 29
  • 34
13
votes
2 answers

Generate Swagger YAML Open API Spec programmatically from WSDL/XML

I have a SOAP API already defined via WSDLs. Is there any tool that I can use to convert WSDL to Open API Swagger documents? I am assuming that I would need to write custom code to to create a Swagger 3.0 Open API YAML specification from an…
sandunes90
  • 455
  • 2
  • 4
  • 22
12
votes
1 answer

How Can I Parse YAML Into a Derived Collection Using YamlDotNet?

Using YamlDotNet, I am attempting to deserialize the following YAML: Collection: - Type: TypeA TypeAProperty: value1 - Type: TypeB TypeBProperty: value2 The Type property is a required property for all objects under Collection. The rest…
Matt Houser
  • 33,983
  • 6
  • 70
  • 88
12
votes
1 answer

How to parse a yaml string

I want to parse yaml in c# in such a way that I get a List of Hashtables. I'm using YamlDotNet. Here is my code: TextReader tr = new StringReader(txtRawData.Text); var reader = new EventReader(new MergingParser(new Parser(tr))); Deserializer des =…
max
  • 9,708
  • 15
  • 89
  • 144
10
votes
1 answer

YamlDotNet - need deserializer to ignore extra nodes or be okay with missing nodes

I am trying to use YamlDotNet to help me parse a config file. I have studies its documentation and found two ways: Using YamlStream's Load() method, followed by examining the nodes of the YamlDocument it has created; Writing a family of related…
onTy
  • 193
  • 2
  • 12
9
votes
2 answers

Build a Yaml document dynamically from c#

Is it possible to build a Yaml document dynamically from c# with Yaml.DotNet or another library? I understand how this can be done using serialisation, however that requires starting with an object structure. I'm looking to find a way to create…
sparkplug
  • 1,317
  • 2
  • 15
  • 32
8
votes
7 answers

How to convert JSON to YAML using YamlDotNet

I am trying to convert JSON to YAML using YamlDotNet. This is the code I have: class Program { static void Main(string[] args) { var json =…
venerik
  • 5,766
  • 2
  • 33
  • 43
8
votes
3 answers

Deserialize a YAML "Table" of data

I am using yamldotnet and c# to deserialize a file created by a third party software application. The following YAML file examples are both valid from the application: #File1 Groups: - Name: ATeam FirstName, LastName, Age, Height: -…
Barry
  • 83
  • 1
  • 1
  • 4
8
votes
3 answers

How to convert YAML to JSON?

I'm looking to convert between a YAML file, and JSON. This was really difficult to find any information on.
Michael Brown
  • 1,585
  • 1
  • 22
  • 36
7
votes
3 answers

Seeking guidance reading .yaml files with C#

Two months later: The YAML (Eve Online blueprint.yaml) file I tried to parse changed a huge deal which also made it much easier to parse using de deserializer. If someone (for whatever reason) would like to see the code, it's updated on…
sPENKMAN
  • 81
  • 1
  • 1
  • 5
7
votes
2 answers

Deserializing YAML into Custom Types

I'm currently trying to deserialize a YAML document into standard .NET objects, such as string for scalar values and Dictionary for mappings, using YamlDotNet library. I guess that Deserializer class is the best option, but its…
mavsic
  • 71
  • 1
  • 2
6
votes
1 answer

YamlDotNet - Custom Serialization

I have a .NET class which represents a RPC method call, like this: class MethodCall { public string MethodName { get; set; } public Collection Arguments { get; set; } } I want to serialize a Collection to YAML. I'm using…
Frederik Carlier
  • 4,606
  • 1
  • 25
  • 36
6
votes
1 answer

Change the scalar style used for all multi-line strings when serialising a dynamic model using YamlDotNet

I am using the following code snippet to serialise a dynamic model of a project to a string (which is eventually exported to a YAML file). dynamic exportModel = exportModelConvertor.ToDynamicModel(project); var serializerBuilder = new…
sparkplug
  • 1,317
  • 2
  • 15
  • 32
6
votes
1 answer

YamlDotNet can not find property

I am trying to create a simple model for parsing a yaml file to my domain object using YamlDotNet. The caveat is, that I want the domain model to be readonly, so I'm attempting to solve this through inheritance and internal setters. For some reason…
Johny Skovdal
  • 2,038
  • 1
  • 20
  • 36
6
votes
1 answer

how to serialize unmatched tags to dictionary?

I'm trying to parse this YAML document using YamlDotNet: title: Document with dynamic properties /a: description: something /b: description: other something Into this object: public class SimpleDoc { [YamlMember(Alias = "title")] …
dnlgmzddr
  • 628
  • 1
  • 7
  • 25
1
2 3
12 13