Does PowerShell support HashTable Serialization?

Sure, you can use PowerShell’s native CliXml format:

@{
  a = 1
  b = [pscustomobject]@{
    prop = "value"
  }
} | Export-Clixml -Path hashtable.ps1xml

Deserialize with Import-CliXml:

PS C:\> $ht = Import-CliXml hashtable.ps1xml
PS C:\> $ht['b'].prop -eq 'value'
True

Leave a Comment