Convert XML To Json with NULL Value Handling
XDocument doc = XDocument.Parse("Specify the XML Content in String Format"); doc.Descendants().Where(f => f.IsEmpty || string.IsNullOrWhiteSpace(f.Value)).Remove(); string jsonText = JsonConvert.SerializeXNode(doc); // this will convert XNode to Json Text
using System.Xml.Linq; using Newtonsoft.Json; using System.Linq;
No comments:
Post a Comment