ConvertFrom-Hashtable¶
SYNOPSIS¶
Converts a hashtable to a PSCustomObject.
SYNTAX¶
ConvertFrom-Hashtable [-InputObject] <Hashtable> [-ProgressAction <ActionPreference>] [<CommonParameters>]
DESCRIPTION¶
Recursively converts a hashtable to a PSCustomObject. This function is useful for converting structured data to objects, making it easier to work with and manipulate.
EXAMPLES¶
EXAMPLE 1¶
$hashtable = @{
Name = 'John Doe'
Age = 30
Address = @{
Street = '123 Main St'
City = 'Somewhere'
ZipCode = '12345'
}
Occupations = @(
@{
Title = 'Developer'
Company = 'TechCorp'
},
@{
Title = 'Consultant'
Company = 'ConsultCorp'
}
)
}
ConvertFrom-Hashtable -InputObject $hashtable
Output:
Name Value
---- -----
Age 30
Address @{ZipCode=12345; City=Somewhere; Street=123 Main St}
Name John Doe
Occupations {@{Title=Developer; Company=TechCorp}, @{Title=Consultant; Company=ConsultCorp}}
Converts the provided hashtable into a PSCustomObject.
PARAMETERS¶
-InputObject¶
The hashtable to convert to a PSCustomObject.
Type: Hashtable
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-ProgressAction¶
{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters¶
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS¶
OUTPUTS¶
PSCustomObject¶
NOTES¶
A custom object representation of the provided hashtable. The returned object preserves the original structure of the input.
RELATED LINKS¶
https://psmodule.io/Hashtable/Functions/ConvertFrom-Hashtable