I am converting a Third-Party Service Response(XML) into JSON format by using JSON.NET.
The Code i have tried so far,
IEnumerable<XElement> xe;
IEnumerable<XElement> xe1;
List<XElement> ele = new List<XElement>();
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
XNamespace ns = "http://www.opentravel.org/OTA/2003/05";
XDocument xd = XDocument.Load(response.GetResponseStream());
xe = xd.Root.Descendants(ns + "PricedItineraries").ToList();
ele = new List<XElement>();
foreach (XElement b in xe)
{
ele.Add(b);
}
}
In above Code, How to convert the ele into JSON format ?
And I have Converted XMLdocument into JSON by using the following way,
Newtonsoft.Json.JsonConvert.SerializeXmlNode(xdoc);
Please let me know if you need more information.
use