Add compact JSON formatting for single-element arrays in video info display
This commit is contained in:
+10
-4
@@ -161,10 +161,16 @@ try {
|
|||||||
$valueDisplay = ('{0} frames ({1}s, {2} fps)' -f $frames, $durationSeconds, $fps)
|
$valueDisplay = ('{0} frames ({1}s, {2} fps)' -f $frames, $durationSeconds, $fps)
|
||||||
}
|
}
|
||||||
elseif ($fieldValue -is [array]) {
|
elseif ($fieldValue -is [array]) {
|
||||||
# Pretty-print array values as JSON, prefixed with a newline so the
|
if ($fieldValue.Count -gt 1) {
|
||||||
# multi-line output starts cleanly under the field label.
|
# Pretty-print array values as JSON, prefixed with a newline so the
|
||||||
$jsonArray = $fieldValue | ConvertTo-Json -Depth 10
|
# multi-line output starts cleanly under the field label.
|
||||||
$valueDisplay = [Environment]::NewLine + $jsonArray
|
$jsonArray = $fieldValue | ConvertTo-Json -Depth 10
|
||||||
|
$valueDisplay = [Environment]::NewLine + $jsonArray
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$jsonArray = $fieldValue | ConvertTo-Json -Depth 10 -Compress
|
||||||
|
$valueDisplay = $jsonArray
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$valueDisplay = $fieldValue
|
$valueDisplay = $fieldValue
|
||||||
|
|||||||
Reference in New Issue
Block a user