title: Hashtables from ConvertFrom-json have different type from powershells built-in hashtables, how do I make them the same?
body: <p>I have a json file (test.json) that looks something like this:</p>
  
  <pre><code>{
      "root":
      {
          "key":"value"
      }
  }
  </code></pre>
  
  <p>I'm loading it into powershell using something like this:</p>
  
  <pre><code>PS &gt; $data = [System.String]::Join("", [System.IO.File]::ReadAllLines("test.json")) | ConvertFrom-Json
  
  root
  ----
  @{key=value}
  </code></pre>
  
  <p><strong>I'd like to be able to enumerate the keys of the 'hashtable' like object that is defined by the json file.</strong>  So, Ideally, I'd like to be able to do something like:</p>
  
  <pre><code>$data.root.Keys
  </code></pre>
  
  <p>and get ["key"] back.  I can do this with the built-in hashtables in powershell, but doing this with a hashtable loaded from json is less obvious. </p>
  
  <p>In troubleshooting this, I've noticed that the fields returned by ConvertFrom-json have different types than those of Powershell's hashtables.  For example, calling .GetType() on a built-in hashtable makes shows that it's of type 'Hashtable':</p>
  
  <pre><code>PS &gt; $h = @{"a"=1;"b"=2;"c"=3}
  PS &gt; $h.GetType()
  
  IsPublic IsSerial Name                                     BaseType
  -------- -------- ----                                     --------
  True     True     Hashtable                                System.Object
  </code></pre>
  
  <p>doing the same for my json object yields PSCustomObject:</p>
  
  <pre><code>PS &gt; $data.root.GetType()
  
  IsPublic IsSerial Name                                     BaseType
  -------- -------- ----                                     --------
  True     False    PSCustomObject                           System.Object
  </code></pre>
  
  <p>Is there any way to cast or transform this object into a typical powershell Hashtable?</p>