title: Convert JSON to XML using JavaScriptSerializer in c#
body: <p>I have a JSON structure like below.</p>
  
  <pre><code>json={
      "page": {
          "mode": "2",
          "ref": "user"
      }
  }
  </code></pre>
  
  <p>I am using the following code for converting JSON to XML.</p>
  
  <p>Reference:
  <a href="http://www.flowgearcoder.net/2013/04/03/convert-between-json-and-xml" rel="nofollow">http://www.flowgearcoder.net/2013/04/03/convert-between-json-and-xml</a></p>
  
  <pre><code>  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());
  </code></pre>
  
  <p>I am getting the following error while executing the xmlSerializer conversion.</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>Can anyone help me figure out this issue?</p>