Modifique um arquivo JSON com o PowerShell sem gravar a BOM
Preciso modificar um arquivo JSON codificado em UTF8 existente com o PowerShell. Eu tentei com o seguinte código:
$fileContent = ConvertFrom-Json "$(Get-Content $filePath -Encoding UTF8)"
$fileContent.someProperty = "someValue"
$fileContent | ConvertTo-Json -Depth 999 | Out-File $filePath
Isso adiciona uma lista técnica ao arquivo e também o codifica em UTF16. É possível terConvertFrom-Json
eConvertTo-Json
não faça a codificação / BOM?