> ## Content Index
> Fetch the complete content index at: https://omgdebugging.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Convert a PSObject to a Hashtable in PowerShell
- URL: https://omgdebugging.com/convert-a-psobject-to-a-hashtable-in-powershell/
- Published: 2019-02-25T12:16:52.000Z
- Updated: 2019-02-25T12:16:52.000Z
- Author: Pranav Jituri
- Tags: #Import 2026-09-24 19:01

This is just for myself when I forget in the future...

An object returned by the `ConvertFrom-JSON` usually returns a PSObject but I need a hash table to properly manipulate and easily pass the hashtable to be consumed by the ARM Template as a parameter.

```
function ConvertTo-HashtableFromPsCustomObject { 
    param ( 
        [Parameter(  
            Position = 0,   
            Mandatory = $true,   
            ValueFromPipeline = $true,  
            ValueFromPipelineByPropertyName = $true  
        )] [object] $psCustomObject 
    );
    Write-Verbose "[Start]:: ConvertTo-HashtableFromPsCustomObject"

    $output = @{}; 
    $psCustomObject | Get-Member -MemberType *Property | % {
        $output.($_.name) = $psCustomObject.($_.name); 
    } 
    
    Write-Verbose "[Exit]:: ConvertTo-HashtableFromPsCustomObject"

    return  $output;
}

```