title: Powershell ConvertTo-json with embedded hashtable
body: <p>I'm having a problem with ConvertTo-Json and was trying to understand the behavior and/or what I'm doing wrong.  </p>
  
  <p>Consider this sequence of commands:</p>
  
  <pre><code>$val=@{ID=10;Config=@{ID=11;Config=@{ID=12;Config='end'}}}
  ConvertTo-json $val
  ConvertTo-json @($val)
  </code></pre>
  
  <p>The first conversion gives this output:</p>
  
  <pre><code>{
      "ID":  10,
      "Config":  {
                     "ID":  11,
                     "Config":  {
                                    "ID":  12,
                                    "Config":  "end"
                                }
                 }
  }
  </code></pre>
  
  <p>The second conversion gives this output:</p>
  
  <pre><code>[
      {
          "ID":  10,
          "Config":  {
                         "ID":  11,
                         "Config":  "System.Collections.Hashtable"
                     }
      }
  ]
  </code></pre>
  
  <p>It seems that in the array case the conversion is incorrect.  Any ideas on why this is happening?</p>