Write json deserialized class to xml file

encroacher

New Member
I deserialized a Json file and I created the c# hierarchy class, but now i can't write the data on a xml file.\[code\] { "id": "294056490711908", "feed": { "data": [ { "from": { "name": "La Mela Di Cant\u00f9", "id": "100001570074603", "picture": { "data": { "url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash4/370557_100001570074603_738581885_q.jpg", "is_silhouette": false } } }, "created_time": "2013-04-06T14:15:02+0000", "message": "Sempre interessanti le novit\u00e0 Festina.\nOrologi di buona qualit\u00e0 a prezzo interessante. Design al passo con le mode e variet\u00e0 di modelli... cosa chiedere di pi\u00f9?\n Venite a trovarci a Cant\u00f9!", "id": "294056490711908_361903560593867" },\[/code\]And so on..These are my classes:\[code\] public class Data { public string url { get; set; } } public class Picture { public Data data { get; set; } } public class From { public static string name { get; set; } public string id { get; set; } public Picture picture { get; set; } } public class Datum { public From from { get; set; } public string created_time { get; set; } public string message { get; set; } public string id { get; set; } public string picture { get; set; } } public class Paging { public string previous { get; set; } public string next { get; set; } } public class Feed { public List<Datum> data { get; set; } public Paging paging { get; set; } } public class RootObject { public string id { get; set; } public Feed feed { get; set; } }\[/code\]This is my code:\[code\]var serializer = new JavaScriptSerializer(); RootObject facebookPosts = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize<RootObject>(data); XmlDocument xmlFacebookPost = new XmlDocument(); xmlFacebookPost.LoadXml("<TableBox><_empty_><Utente></Utente><testo></testo><immagine_profilo></immagine_profilo><photo></photo></_empty_></TableBox>"); foreach (var item in facebookPosts.feed) { XmlNode node = xmlFacebookPost.CreateNode(XmlNodeType.Element, "_empty_", null); XmlElement utente = xmlFacebookPost.CreateElement("Utente"); utente.SetAttribute("Utente", From.name); xmlFacebookPost.DocumentElement.AppendChild(utente); }\[/code\]Now, I can't write the data in the file because if i edit "public Feed feed" in "public List feed" there aren't item.Thank you!
 
Top