Flatten objects into runnable PowerShell syntax.
Like ConvertTo-Json
, but without the extra step to get the objects back.
> ConvertTo-PSExpression @{foo = 'bar'}
@{foo = 'bar'}
> $Sport = New-Object PSObject -Property @{ping = 'pong'}
> ConvertTo-PSExpression $Sport
[pscustomobject]@{ping = 'pong'}