IRestResponse<List<Table>> restResponse = restClient.Get<List<Table>>(request);
var resultsContent = restResponse.Content;
doc.LoadXml(resultsContent);
string json = JsonConvert.SerializeXmlNode(doc);
var jObject = JObject.Parse(json);
string test = jObject.GetValue("table").ToString();
var ss = new JsonSerializer();
List<Table> table;
var x = new XmlSerializer(typeof(Table));
using (var r = new StringReader(resultsContent))
{
table = (List<Table>)x.Deserialize(r);
}
[XmlRoot("table")]
public class Table
{
public Row row;
}
public class Row
{
[XmlAttribute]
public string id;
[XmlAttribute]
public string employeeId;
[XmlElement]
public Field[] field;
}
public class Field
{
[XmlAttribute]
public string id;
[XmlText]
public string value;
}
XML
<?xml version="1.0"?>
<table>
<row id="18" employeeId="20">
<field id="date">2017-05-15</field>
<field id="location">test</field>
<field id="department">Production (Direct)</field>
<field id="division">abc</field>
<field id="jobTitle">Stores Material Handler</field>
<field id="reportsTo">abc cde</field>
</row>
<row id="19" employeeId="20">
<field id="date">2017-06-15</field>
<field id="location">test</field>
<field id="department">Production (Direct)</field>
<field id="division">abc</field>
<field id="jobTitle">Stores Material Handler</field>
<field id="reportsTo">abc cdettt</field>
</row>
<row id="20" employeeId="20">
<field id="date">2017-07-15</field>
<field id="location">test</field>
<field id="department">Production (Direct)</field>
<field id="division">abc</field>
<field id="jobTitle">Stores Material Handler</field>
<field id="reportsTo">abc cde111</field>
</row>
</table>
IRestResponse<List<Table>> restResponse = restClient.Get<List<Table>>(request);
var resultsContent = restResponse.Content;
doc.LoadXml(resultsContent);
string json = JsonConvert.SerializeXmlNode(doc);
var json1 = Newtonsoft.Json.JsonConvert.DeserializeObject(json);
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.