Json.NET - Converting JSON to XML and Vice Versa
Json.Net supports the conversion from XML to JSON and JSON and XML vice versa.
JSON to XML Conversion.
We are going to use
DeserializeXNode(string json, string nodeName)
method defined in JsonConvert class to convert JSON to XML It will return an XNode object containing the XML. You will need to import System.Xml and System.Xml.Linq namespaces for this sample to work correctly
XML to JSON Conversion
We are going to use the following method
SerializeXmlNode(XmlDocument document)
method for doing the conversion from XML to JSON. This method will return a string containing the json. First you need to load the xml into an instance of XmlDocument and then call the SerializeXmlNode method defined in JsonConvert class to do the conversion.
No Comments
Connecting Azure Blob Storage account using Managed Identity
Posted 12/9/2022Securing Azure KeyVault connections using Managed Identity
Posted 11/26/2022Manage application settings with Azure KeyVault
Posted 11/9/2022Adding Serilog to Azure Functions created using .NET 5
Posted 4/3/2021Learn how to split log data into different tables using Serilog in ASP.NET Core
Posted 4/23/2020