Skip to content

Instantly share code, notes, and snippets.

@icodeintx
Created September 1, 2022 12:56
Show Gist options
  • Save icodeintx/adefb11c3a277e5bb5e1baee2a29380d to your computer and use it in GitHub Desktop.
Save icodeintx/adefb11c3a277e5bb5e1baee2a29380d to your computer and use it in GitHub Desktop.
Xml To Json
string xmlContent = File.ReadAllText(@"c:\test\mismo.xml");
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlContent);
string json = JsonConvert.SerializeXmlNode(doc);
RootObject message = JsonConvert.DeserializeObject<RootObject>(json);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment