3
We can serialize objects (I’ll use as an example C#
) for XML
, using the class System.Xml.Serialization.XmlSerializer
, for example:
var obj = new AlgumaClasse();
System.Xml.Serialization.XmlSerializer xmlSerializer = new System.Xml.Serialization.XmlSerializer(obj.GetType());
System.IO.StringWriter writer = new System.IO.StringWriter();
xmlSerializer.Serialize(writer, obj);
var xmlString = writer.ToString();
Or to json
using for example the package Newtonsoft
, with class Newtonsoft.Json.JsonConvert.SerializeObject
:
var obj = new AlgumaClasse();
var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
My question is: how to serialize an object to the format yaml
?
Is there any class or package that does this similarly to the above examples?
worked out?.....
– novic
Yes, I used the "Yamldotnet.Netcore" and attended well, thank you :)
– Ricardo Pontual