scripts/helpers/Write-FpacJsonFile.ps1

function Write-FpacJsonFile {
    param (
        [Parameter(Mandatory)]
        [string] $Path,

        [Parameter(Mandatory)]
        [object] $Value
    )

    $parent = Split-Path -Parent $Path
    if (-not (Test-Path -LiteralPath $parent -PathType Container)) {
        New-Item -ItemType Directory -Path $parent -Force | Out-Null
    }
    $Value | ConvertTo-Json -Depth 40 |
        Set-Content -LiteralPath $Path -Encoding utf8
}