param ( [Parameter(Mandatory=$true)] [string]$jsonfile, [Parameter(Mandatory=$true)] [string]$export ) # Read the original JSON data from the file $JsonData = Get-Content -Path $jsonfile -Raw # Convert JSON string to a PowerShell object $JsonObject = $JsonData | ConvertFrom-Json # Convert back to JSON with indentation and formatting $FormattedJson = $JsonObject | ConvertTo-Json -Depth 100 # Write the formatted JSON string to the output file Set-Content -Path $export -Value $FormattedJson remove-item $jsonfile -Force -Verbose Write-Host "✅ JSON reformatted with line breaks and saved to: $export"