Medium Feed


Tuesday, March 3, 2015

JSON to XML conversion : Error "This document already has a ' DocumentElement ' node"

 Today I had faced an  error while converting JSON string into an XML document object using Jsonconvert.

Here is the code snippet

        FacebookClient fbclient = new FacebookClient();
        JObject objFeeb = JObject.Parse(@" " + fbclient.Get("me/feed") + " ");
        XmlDocument doc = JsonConvert.DeserializeXmlNode(objFeeb.ToString());

When I run the above code I was getting an error as  "This document already has a ' DocumentElement ' node"

To fix the issue, I  just have defined the root element of XML doc and it worked !!

Here is the working code.

  XmlDocument doc = JsonConvert.DeserializeXmlNode(objFeeb.ToString(), "FacebookFeed");


  1. Nor ought to you rule out special company rates if your volumes are excessive.can you fax documents online

  2. An individual can change over PDF document into some other helpful organization and furthermore make PDF out of some other application. PDF to PNG