XDocument doc = XDocument.Parse(xmlData); //or XDocument.Load(path)
string jsonText = JsonConvert.SerializeXNode(doc);
dynamic dyn = JsonConvert.DeserializeObject<ExpandoObject>(jsonText);
I think “cheating” is the answer – the xml solutions are very long 🙂
More Related Contents:
- How to convert JSON to XML or XML to JSON?
- How to convert XML to JSON using C#/LINQ?
- How to convert JSON to XML or XML to JSON in C#?
- Using Xpath With Default Namespace in C#
- XDocument or XmlDocument
- Recursion, parsing xml file with attributes into treeview c#
- How to exclude property from Json Serialization
- Getting ServiceStack to retain type information
- Json.net serialize/deserialize derived types?
- Deserializing JSON when sometimes array and sometimes object
- Convert JSON String to JSON Object c#
- How do I convert an escaped JSON string within a JSON object?
- HTTP post XML data in C#
- Change values in JSON file (writing files)
- Getting attribute value of an XML Document using C#
- JSON string to CSV and CSV to JSON conversion in c#
- How to check if a file exists in a folder?
- How to define multiple names for XmlElement field?
- How do I get a deeply-nested property from JSON string?
- How to create XmlElement attributes with prefix?
- Serializing an interface/abstract object using NewtonSoft.JSON
- How to use XPath function in a XPathExpression instance programatically?
- Binding properties in code behind
- Use the XmlInclude or SoapInclude attribute to specify types that are not known statically
- JSonNet boolean serialization
- How/Can I use linq to xml to query huge xml files with reasonable memory consumption?
- Writing XML attributes and namespace declarations in a specific order
- How do I get formatted and indented JSON in .NET using C#?
- Serializing/Deserializing Dictionary of objects with JSON.NET
- Parsing SVG “path” elements with C# – are there libraries out there to do this? [closed]