Suppose we have a class which can be serialized/deserialized by XmlSerializer. It would be like so:
[XmlRoot(\"ObjectSummary\")]
public class Summary
{
using Newtonsoft.Json;
[XmlRoot("ObjectSummary")]
public class Summary
{
public string Name {get;set;}
public string IsValid {get;set;}
}
//pass objectr of Summary class you want to convert to XML
var json = JsonConvert.SerializeObject(obj);
XNode node = JsonConvert.DeserializeXNode(json, "ObjectSummary");
If you have more than one object, put it inside a list and Serialize List.
dynamic obj = new ExpandoObject();
obj.data = listOfObjects;
var json = JsonConvert.SerializeObject(obj);
XNode node = JsonConvert.DeserializeXNode(json, "ObjectSummary");