Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

C# Xml to Json

XDocument doc = XDocument.Load(@"c:	est.xml"); //or XDocument.Parse(xmlData)
            string jsonText = JsonConvert.SerializeXNode(doc);
            // dynamic dyn = JsonConvert.DeserializeObject<ExpandoObject>(jsonText);
            dynamic results = JsonConvert.DeserializeObject<dynamic>(jsonText);
            
            JArray items = (JArray)results["UserList"]["User"];
            int girilen = items.Count;
            
            
            foreach (dynamic item in results)
            {
                Console.WriteLine(item.UserList);
            }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Xml #Json
ADD COMMENT
Topic
Name
2+5 =