Types/OpenPackage.Part/ReadJson.ps1
|
<# .SYNOPSIS Reads Part Content as Json .DESCRIPTION Reads Open Package Part Content as Json #> [Reflection.AssemblyMetadata('FilePattern', '\.jsonc?$')] [Reflection.AssemblyMetadata('ContentTypePattern', '[/\+]jsonc?$')] param( # An optional input object # If provided, content will be read from this object. # If not provided, content will be read from this part. [Alias('Input')] [PSObject]$InputObject = $null, # Any options used to read the data. [Alias('Options')] [Collections.IDictionary]$Option = [Ordered]@{} ) if (-not $this.ReadText) { return } $partText = $this.ReadText($InputObject, $Option) if (-not $partText) { return } # This is faster than ConvertFrom-Json $ConvertFromJson = [Microsoft.PowerShell.Commands.JsonObject]::ConvertFromJson if (-not $ConvertFromJson) { return } $ConvertFromJson.Invoke( $partText, $option.hashtable, $option.Depth, [ref]$null ) |