title: Transmit javascript object into controller action as dictionary
body: <p>Is there a way to pass this javascript object</p>
  
  <pre><code>Object { 35=true, 179=true, 181=true}
  </code></pre>
  
  <p>into a controller action as</p>
  
  <pre><code>Dictionary&lt;int, bool&gt;
  </code></pre>
  
  <p>I've checked the following methods:</p>
  
  <pre><code>    var remoteUrl = "@Url.Action("UpdateProjectStructureSelection")" + "?tlpId=@Model.TopLevelProjectId";
      $.post(remoteUrl, mapSiteSelectionChoices, function(callbackResult) {
          alert(callbackResult);
      });
  </code></pre>
  
  <p>and </p>
  
  <pre><code>    var remoteUrl = "@Url.Action("UpdateProjectStructureSelection")" + "?tlpId=@Model.TopLevelProjectId";
      $.post(remoteUrl, { values : mapSiteSelectionChoices }, function(callbackResult) {
          alert(callbackResult);
      });
  </code></pre>
  
  <p>However in both cases </p>
  
  <pre><code>public ActionResult UpdateProjectStructureSelection(int tlpId, Dictionary&lt;int, bool&gt; values)
  </code></pre>
  
  <p>has been called, but values was empty. </p>
  
  <p>Since i've transfered more complex types into a controller action without writing a custom model binder i've been wondering whether i'm just doing something wrong here.</p>
  
  <p>Is a custom model binder the only way here to get it as dictionary? (other than using JsonConvert + stringify on clientside)</p>
  
  <p>Addition (This works but i'd love to avoid extra code) : </p>
  
  <pre><code>    public ActionResult UpdateProjectStructureSelection(int tlpId, string values)
      {
          var dict = JsonConvert.DeserializeObject&lt;Dictionary&lt;int, bool&gt;&gt;(values);
      }
  </code></pre>