Convert JSON from SqlDataReader to XML

Dec 20, 2011 at 4:48 AM

I'm new to C# and JSON so excuse me if this is a basic question.  However, I have a SQLDataReader and am wanting to convert the json column to an XML file.  I am using JsonConvert.DeserializeXmlNode and then writing it to an XMLWriter.  This works fine for the first record but when it loops and tries to write the second 'document' to the file, it gets this error:

"Token StartElement in state Epilog would result in an invalid XML document."

What is the most efficient way to loop through a SQLDataReader and get the json converted and written to an XML file?

I have to add a "root" node to this file, which I already have coded.  I'm just trying to get the details in there now.