mirror of
https://github.com/rbalsleyMSFT/FFU.git
synced 2026-06-14 10:19:36 -06:00
Standardizes JSON output: depth, UTF-8, key order
- Sorts top-level config keys before serialization for deterministic files and cleaner diffs. - Increases JSON depth to 10 to retain nested settings. - Writes JSON as UTF-8 via Set-Content for consistent encoding. - Applies across config export and UI save flows.
This commit is contained in:
@@ -4004,7 +4004,7 @@ function Export-ConfigFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Convert to JSON and save
|
# 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 {
|
function Get-PEArchitecture {
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -410,7 +410,10 @@ $script:uiState.Controls.btnRun.Add_Click({
|
|||||||
}
|
}
|
||||||
|
|
||||||
$configFilePath = Join-Path $config.FFUDevelopmentPath "\config\FFUConfig.json"
|
$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
|
$script:uiState.Data.lastConfigFilePath = $configFilePath
|
||||||
|
|
||||||
if ($config.InstallOffice -and $config.OfficeConfigXMLFile) {
|
if ($config.InstallOffice -and $config.OfficeConfigXMLFile) {
|
||||||
|
|||||||
@@ -727,7 +727,10 @@ function Invoke-SaveConfiguration {
|
|||||||
-DefaultExt ".json"
|
-DefaultExt ".json"
|
||||||
|
|
||||||
if ($savePath) {
|
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")
|
[System.Windows.MessageBox]::Show("Configuration file saved to:`n$savePath", "Success", "OK", "Information")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user