This project has moved and is read-only. For the latest updates, please go here.

Convert Xml list to Json

Feb 28, 2012 at 12:51 PM


I have a list that have been generated by a XmlSerializer. The result look like:

<?xml version="1.0" encoding="utf-8"?>
<MyObject xmlns:xsi="" xmlns:xsd="">

After, I try to use this code snippet:

string jsonText = JsonConvert.SerializeXmlNode(doc, Formatting.None, true);

var obj = JsonConvert.DeserializeObject

Than, I got an error. Two things, Json.Net doesn't seems to like when there is namespace in the xml. That I can easily remove it.
The things I don't know how to handle is that Json.Net seems to be only able to manage xml list like:


Is there a way than Json.Net can handle easily the list serialized by a XmlSerializer?