function Write-JsonNamePrimitiveArrayPair { <# .SYNOPSIS Used to write the value for string pairs to a Json object #> param ( $JsonName, $JsonValue, $Depth = 0, [switch]$OrderedKeys ) $spacesString, $shortSpacesString = (Get-JsonStringLeadsByDepth -Depth $Depth) $quoteString = '"' $commaString = "," $stringBuilder = (New-Object System.Text.StringBuilder) $stringBuilder.Append($shortSpacesString).Append('"{0}" : [' -f $JsonName) | Out-Null foreach ($iter in $JsonValue) { $stringBuilder.Append($spacesString).Append($iter).Append($commaString) | Out-Null } $stringBuilder.Append($shortSpacesString).Append('],') | Out-Null return $stringBuilder.ToString() }