Simple XML to JSON and JSON to XML

Apr 7, 2009 at 4:47 AM
I really need some help on this. I am under a deadline. I am looking to preform a simple XML to JSON conversation. I thought that Json.NET would provide this but I see to have some issues.

My code is as follows.

        string sUrl = "C:\\Inetpub\\wwwroot\\asklaila - Events(Hyderabad).xml";
        StreamReader re = File.OpenText(sUrl);
        string input = null;
        while ((input = re.ReadLine()) != null)

        JsonSerializer jsoncon = new JsonSerializer();
        JsonReader jread = new JsonReader(re);

jread is null. What am I doing wrong? I just need a simple translation from wither end.The same hting happens when I feed it the content from a Stream that I recieved frmo a URL call.

Thanks in advance.
Apr 8, 2009 at 4:17 AM
Edited Apr 8, 2009 at 4:23 AM
Apr 8, 2009 at 3:38 PM

Thanks. I am following the example but and still having issues.

In my program I am reading in

By Calling this is a browser it returns valid JSONbut I am still getting the error. My Code is as follows.
        XmlDocument xmlDoc = new XmlDocument();
       string sUrl = HttpGet(""); // Reads in Response Stream
        xmlDoc = (XmlDocument)JavaScriptConvert.DeerializeXmlNode(sUrl);

What am I doing wrong?

Thanks in advance.