Add-Type -Path PowerShellRuntimeExtensions.dll
# Import-Module PowerShellRuntimeExtensions.DLL
function ConvertFrom-Json20([object] $inputObject)
{
$err = $null
return [PowerShellRuntimeExtensions.JsonObject]::ConvertFromJson($inputObject, $false, 4, [ref]$err)
}
function ConvertTo-Json20([object] $inputObject, $depth = 5)
{
$ctx = New-Object PowerShellRuntimeExtensions.ConvertToJsonContext $depth, $false, $false, 'Default'
return [PowerShellRuntimeExtensions.JsonObject]::ConvertToJson($inputObject, [ref]$ctx)
}
if ($null -eq (Get-Command 'ConvertTo-Json' -ErrorAction SilentlyContinue)) { New-Alias -Name 'ConvertTo-JSON' -Value 'ConvertTo-Json20' -Scope Global -Force }
if ($null -eq (Get-Command 'ConvertFrom-Json' -ErrorAction SilentlyContinue)) { New-Alias -Name 'ConvertFrom-JSON' -Value 'ConvertFrom-JSON' -Scope Global -Force }-
Notifications
You must be signed in to change notification settings - Fork 0
Overwrites the default ConvertTo/From-Json with a auto-type checked and serialized version to the best format
License
Calvindd2f/powershell-runtime-extension
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
Overwrites the default ConvertTo/From-Json with a auto-type checked and serialized version to the best format