Skip to content

ConvertFrom-Hashtable

SYNOPSIS

Converts a hashtable to a PSCustomObject.

SYNTAX

__AllParameterSets

ConvertFrom-Hashtable [-InputObject] <hashtable> [<CommonParameters>]

ALIASES

This cmdlet has the following aliases, {{Insert list of aliases}}

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: System.Collections.Hashtable
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 0
  IsRequired: true
  ValueFromPipeline: true
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.Collections.Hashtable

{{ Fill in the Description }}

OUTPUTS

PSCustomObject

{{ Fill in the Description }}

System.Management.Automation.PSObject

{{ Fill in the Description }}

NOTES

A custom object representation of the provided hashtable. The returned object preserves the original structure of the input.