diff --git a/FFUDevelopment/BuildFFUVM.ps1 b/FFUDevelopment/BuildFFUVM.ps1 index 21c94a0..1ba5876 100644 --- a/FFUDevelopment/BuildFFUVM.ps1 +++ b/FFUDevelopment/BuildFFUVM.ps1 @@ -4004,7 +4004,7 @@ function Export-ConfigFile { } # Convert to JSON and save - $orderedParams | ConvertTo-Json | Out-File $ExportConfigFile -Force + $orderedParams | ConvertTo-Json -Depth 10 | Set-Content -Path $ExportConfigFile -Encoding UTF8 } function Get-PEArchitecture { param( diff --git a/FFUDevelopment/BuildFFUVM_UI.ps1 b/FFUDevelopment/BuildFFUVM_UI.ps1 index 182884e..9b4e054 100644 --- a/FFUDevelopment/BuildFFUVM_UI.ps1 +++ b/FFUDevelopment/BuildFFUVM_UI.ps1 @@ -410,7 +410,10 @@ $script:uiState.Controls.btnRun.Add_Click({ } $configFilePath = Join-Path $config.FFUDevelopmentPath "\config\FFUConfig.json" - $config | ConvertTo-Json -Depth 10 | Set-Content -Path $configFilePath -Encoding UTF8 + # Sort top-level keys alphabetically for consistent output + $sortedConfig = [ordered]@{} + foreach ($k in ($config.Keys | Sort-Object)) { $sortedConfig[$k] = $config[$k] } + $sortedConfig | ConvertTo-Json -Depth 10 | Set-Content -Path $configFilePath -Encoding UTF8 $script:uiState.Data.lastConfigFilePath = $configFilePath if ($config.InstallOffice -and $config.OfficeConfigXMLFile) { diff --git a/FFUDevelopment/FFUUI.Core/FFUUI.Core.Config.psm1 b/FFUDevelopment/FFUUI.Core/FFUUI.Core.Config.psm1 index 43a65f6..9a322b7 100644 --- a/FFUDevelopment/FFUUI.Core/FFUUI.Core.Config.psm1 +++ b/FFUDevelopment/FFUUI.Core/FFUUI.Core.Config.psm1 @@ -727,7 +727,10 @@ function Invoke-SaveConfiguration { -DefaultExt ".json" if ($savePath) { - $config | ConvertTo-Json -Depth 10 | Set-Content -Path $savePath -Encoding UTF8 + # Sort top-level keys alphabetically for consistent output + $sortedConfig = [ordered]@{} + foreach ($k in ($config.Keys | Sort-Object)) { $sortedConfig[$k] = $config[$k] } + $sortedConfig | ConvertTo-Json -Depth 10 | Set-Content -Path $savePath -Encoding UTF8 [System.Windows.MessageBox]::Show("Configuration file saved to:`n$savePath", "Success", "OK", "Information") } }