diff --git a/Get-VideoInfo.ps1 b/Get-VideoInfo.ps1 index 2c12b12..a04189a 100644 --- a/Get-VideoInfo.ps1 +++ b/Get-VideoInfo.ps1 @@ -161,10 +161,16 @@ try { $valueDisplay = ('{0} frames ({1}s, {2} fps)' -f $frames, $durationSeconds, $fps) } elseif ($fieldValue -is [array]) { - # Pretty-print array values as JSON, prefixed with a newline so the - # multi-line output starts cleanly under the field label. - $jsonArray = $fieldValue | ConvertTo-Json -Depth 10 - $valueDisplay = [Environment]::NewLine + $jsonArray + if ($fieldValue.Count -gt 1) { + # Pretty-print array values as JSON, prefixed with a newline so the + # multi-line output starts cleanly under the field label. + $jsonArray = $fieldValue | ConvertTo-Json -Depth 10 + $valueDisplay = [Environment]::NewLine + $jsonArray + } + else { + $jsonArray = $fieldValue | ConvertTo-Json -Depth 10 -Compress + $valueDisplay = $jsonArray + } } else { $valueDisplay = $fieldValue