I have a JSON structure like below.
json={
"page": {
"mode": "2",
"ref": "user"
}
}
I am using the following code for converting JSON to XML.
Reference: http://www.flowgearcoder.net/2013/04/03/convert-between-json-and-xml
var dynamicObject = new System.Web.Script.Serialization.JavaScriptSerializer().DeserializeObject(Json);
System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(dynamicObject.GetType());
MemoryStream ms = new MemoryStream();
serializer.Serialize(ms, dynamicObject);
Xml = System.Text.Encoding.UTF8.GetString(ms.ToArray());
I am getting the following error while executing the xmlSerializer conversion.
The type System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089], [System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] is not supported because it implements IDictionary.
Can anyone help me figure out this issue?