title: ajax call serialize and deserialize data
body: <p>I have the following ajax call:</p>
  
  <pre><code>$(document).ready(function() {
              $.ajax({
                  type: "POST",
                  url: "/LoadCount.aspx/GetCounts",
                  contentType: "application/json; charset=utf-8",
                  data: "",
                  async: false,
                  dataType: "json",
                  success: function(data) {
                    var myObj = JSON.parse(data.d);
                    alert(myObj.length);
                    for (var i = 0; i &lt; myObj.length; i++) {
                      alert(myObj[0]);
                    }
  
                  },
                  error: function(xhr, status, error) {
                      var err = eval("(" + xhr.responseText + ")");
                      alert(err.Message);
                  }
              });
          });
  </code></pre>
  
  <p>I am getting <strong>undefined</strong> when I alert the <strong>length</strong></p>
  
  <p>Here's my Method in my LoadCount.aspx</p>
  
  <pre><code>[WebMethod]
      public static string ObtenerContador()
  {
      List&lt;MenuItem&gt; menu =(List&lt;MenuItem&gt;)HttpContext.Current.Session["MenuItems"];
  
      Dictionary&lt;string, int&gt; dic = new Dictionary&lt;string, int&gt;();
      foreach (MenuItemAMostrar item in menu)
      { 
          dic.Add(item.ControlID,1);
      };
  
      return new JavaScriptSerializer().Serialize(dic); //or any other suggested serialization method
  }
  </code></pre>
  
  <p>this is what I am getting in the success function:</p>
  
  <pre><code>{"MenuCLESAAsignar":1,"MenuOCGestores":1,"MenuOcAAutorizar":1,"MenuOcAAutorizarBanco":1,"MenuOCGestoresObservadas":1,"MenuCLESActivos":1,"MenuParametros":1,"MenuCLESConAddendaAAprobarSup":1,"MenuPendienteAprobacion":1,"MenuConsultaCLES":1}
  </code></pre>
  
  <p>The question is, how do I <strong>deserialize</strong> that dictionary in my ajax success function?
  Once deserialized, how do I <strong>populate</strong> it, obtaining the data?</p>
  
  <p>thanks!</p>