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:
- [Joe, Soap, 21, 184]
- [Mary, Ryan, 20, 169]
- [Alex, Dole, 24, 174]
#File2
Groups:
- Name: ATeam
FirstName, LastName, Height:
- [Joe, Soap, 184]
- [Mary, Ryan, 169]
- [Alex, Dole, 174]
Notice that File2 doesnt have any Age column but the deserializer must still recognise that the third value on each line is a height rather than an age. This data is supposed to represent a table of people. In the case of File1 for example, Mary Ryan is age 20 and is 169cm tall. The deserializer needs to understand the columns it has (for File2 it only has FirstName, LastName and Height) and store the data accordingly in the right objects : Mary Ryan is 169cm tall.
Similarly the program documentation states that the order of the columns is not important so File3 below is an equally valid way to represent the data in File2 even though Height is now first:
#File3
Groups:
- Name: ATeam
Height, FirstName, LastName:
- [184, Joe, Soap]
- [169, Mary, Ryan]
- [174, Alex, Dole]
I have a number of questions:
- Is this standard YAML? - I could not find anything about the use of a number of keys on the same line followed by a colon and lists of values to represent tables of data.
- How would I use yamldotnet to deserialize this? Are there modifications I can make to help it?
- If I can't use yamldotnet, how should I go about it?