0

Getting issue with below code

System.Xml.XmlDocument xd1 = new System.Xml.XmlDocument();
xd1 = (System.Xml.XmlDocument)Newtonsoft.Json.JsonConvert.DeserializeXmlNode(customJsonArrayData.ToString(), currentSheetName); //getting issue here.
DataSet jsonDataSet = new DataSet();
jsonDataSet.ReadXml(new System.Xml.XmlNodeReader(xd1));

I had gone through link, but do we have any short simple answer than given in that post.

chandra sekhar
  • 1,093
  • 4
  • 14
  • 27
  • Did the solution work in your project?If not,could you share `customJsonArrayData.ToString()` and `currentSheetName`? – Rena Sep 24 '19 at 05:41

1 Answers1

0

For XmlNodeConverter can only convert JSON that begins with an object,you could add the object manually like below:

xd1 = (System.Xml.XmlDocument)Newtonsoft.Json.JsonConvert.DeserializeXmlNode("{\"root \":"+yourJsonString+"}","root");
Rena
  • 30,832
  • 6
  • 37
  • 72