Skip to content

Convert-HashtableToCode does not work with array of hash tables #91

@pluma9

Description

@pluma9

Describe the bug
When passing a hash table, whose one of the values contains an array of hash tables, to Convert-HashtableToCode, the output is not as expected.

To Reproduce

C:\> $department = @{DepartmentName="IT"; Managers = @(@{Name="John"; Age=33}, @{Name="David";  Age = 31})}
C:\> Convert-HashtableToCode $department
@{
        Managers = 'System.Collections.Hashtable','System.Collections.Hashtable'
        DepartmentName = 'IT'
}

Expected behavior
The output should be:

@{
        Managers = @(@{Name="John"; Age=33}, @{Name="David";  Age = 31})
        DepartmentName = 'IT'
}

Desktop (please complete the following information):

  • Operating System Version: Windows 10
  • Module Version: 2.29.0
  • PowerShell Version: 5.1.19041.1
  • Powershell Edition: Desktop

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions