public SerializedResult Serialize(IEnumerable <ParsedDataResult> parsedResults) { var adapter = new SerializedRootAdapter(); var root = adapter.GetFromParsedDataResult(parsedResults); var jsonData = JsonConvert.SerializeObject(root); return(new SerializedResult(jsonData, "application/json")); }
public SerializedResult Serialize(IEnumerable <ParsedDataResult> parsedResults) { var adapter = new SerializedRootAdapter(); var root = adapter.GetFromParsedDataResult(parsedResults); var xmlSerializer = new XmlSerializer(root.GetType()); using (var textWriter = new StringWriter()) { xmlSerializer.Serialize(textWriter, root); var xmlData = textWriter.ToString(); return(new SerializedResult(xmlData, "application/xml")); } }