Helper/Get-ObjectFromJson.ps1
function Get-ObjectFromJson { param ( [Parameter(Mandatory=$true)] [string]$source ) $tmpFile = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) $tmpFile += '.json' if ($Source.ToLower().StartsWith('http')) { Get-File -sourceUrl $Source -destinationFile $tmpFile } else { Copy-Item -Path $Source -Destination $tmpFile -Force } try { Write-Verbose "Converting $source to Object" $Destination = Get-Content $tmpFile | ConvertFrom-Json } finally { Remove-Item $tmpFile -Force -ErrorAction SilentlyContinue } Return $Destination } Export-ModuleMember -Function Get-ObjectFromJson |